Fix false positive in coverity

Coverity assumes that casting a void pointer to anything else is
tainted, which gives warning when casting the `rd_amcache` field to
anything else. Since this is what the field is used for, we mark the
cast from `void*` to `HypercoreInfo*` as a false positive.
This commit is contained in:
Mats Kindahl 2024-10-21 12:04:04 +02:00 committed by Mats Kindahl
parent 647e558871
commit 76e3b27b69

View File

@ -279,14 +279,15 @@ lazy_build_hypercore_info_cache(Relation rel, bool create_chunk_constraints,
HypercoreInfo * HypercoreInfo *
RelationGetHypercoreInfo(Relation rel) RelationGetHypercoreInfo(Relation rel)
{ {
if (NULL == rel->rd_amcache) /*coverity[tainted_data_downcast : FALSE]*/
rel->rd_amcache = lazy_build_hypercore_info_cache(rel, HypercoreInfo *info = rel->rd_amcache;
true /* create constraints */,
NULL /* compressed rel created */);
Assert(rel->rd_amcache && OidIsValid(((HypercoreInfo *) rel->rd_amcache)->compressed_relid)); if (NULL == info)
info = rel->rd_amcache = lazy_build_hypercore_info_cache(rel, true, NULL);
return rel->rd_amcache; Assert(info && OidIsValid(info->compressed_relid));
return info;
} }
static void static void