1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-28 02:33:10 +03:00

Silence Coverity warning about unused visibilitymap_clear() result

Commit c0d9864f5c made all but one caller of visibilitymap_clear() check
its return value, causing Coverity to flag the remaining unchecked call
in heap_page_fix_vm_corruption().

This VM clear is not WAL-logged, so the caller doesn't need the return
value of visibilitymap_clear(). Add an explicit void cast and comment to
document that the return value is intentionally ignored.

Backpatch to 19 when the number of callers discarding the return value
dropped low enough to trigger Coverity's warning.

Discussion: https://postgr.es/m/1065814.1784514869%40sss.pgh.pa.us
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 19
This commit is contained in:
Melanie Plageman
2026-08-04 18:04:28 -04:00
parent 18992dc9d9
commit a37e574545

View File

@@ -948,9 +948,10 @@ heap_page_fix_vm_corruption(PruneState *prstate, OffsetNumber offnum,
if (do_clear_vm)
{
LockBuffer(prstate->vmbuffer, BUFFER_LOCK_EXCLUSIVE);
visibilitymap_clear(prstate->relation->rd_locator, prstate->block,
prstate->vmbuffer,
VISIBILITYMAP_VALID_BITS);
/* This VM clear is not WAL-logged, so its return value is not needed. */
(void) visibilitymap_clear(prstate->relation->rd_locator,
prstate->block, prstate->vmbuffer,
VISIBILITYMAP_VALID_BITS);
LockBuffer(prstate->vmbuffer, BUFFER_LOCK_UNLOCK);
prstate->old_vmbits = 0;
}