From fef49a0e861fcc7e8d962116e7f99aabf182d53a Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 28 Mar 2024 22:43:16 +0100 Subject: [PATCH] cov: remove unnecessary sanity check This sanity check actually confused in some way Coverity giving it some assumption about array access. Since these two checks basically validated compiler's capability to add and then substract the number from char pointer we likely don't really need them - as if this base math would not work, compiler would be having far more troubles... So drop them - and get rid of report: Event overrun-call: Overrunning callee's array of size 513 by... --- tools/pvck.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tools/pvck.c b/tools/pvck.c index 7377a032c..76fcf45c3 100644 --- a/tools/pvck.c +++ b/tools/pvck.c @@ -1068,10 +1068,6 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect pvh = (struct pv_header *)(buf + 32); pvh_offset = lh_offset + 32; /* from start of disk */ - /* sanity check */ - if ((void *)pvh != (void *)(buf + pvh_offset - lh_offset)) - log_print("CHECK: problem with pv_header offset calculation"); - if (print_fields) { log_print("pv_header at %llu", (unsigned long long)pvh_offset); log_print("pv_header.pv_uuid %s", _chars_to_str(pvh->pv_uuid, str, ID_LEN, 256, "pv_header.pv_uuid")); @@ -1090,10 +1086,6 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect dlocn = pvh->disk_areas_xl; dlocn_offset = pvh_offset + 40; /* from start of disk */ - /* sanity check */ - if ((void *)dlocn != (void *)(buf + dlocn_offset - lh_offset)) - log_print("CHECK: problem with pv_header.disk_locn[%d] offset calculation", di); - while (xlate64(dlocn->offset)) { if (print_fields) { log_print("pv_header.disk_locn[%d] at %llu # location of data area", di,