1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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...
This commit is contained in:
Zdenek Kabelac 2024-03-28 22:43:16 +01:00
parent fe2294769c
commit fef49a0e86

View File

@ -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 = (struct pv_header *)(buf + 32);
pvh_offset = lh_offset + 32; /* from start of disk */ 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) { if (print_fields) {
log_print("pv_header at %llu", (unsigned long long)pvh_offset); 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")); 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 = pvh->disk_areas_xl;
dlocn_offset = pvh_offset + 40; /* from start of disk */ 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)) { while (xlate64(dlocn->offset)) {
if (print_fields) { if (print_fields) {
log_print("pv_header.disk_locn[%d] at %llu # location of data area", di, log_print("pv_header.disk_locn[%d] at %llu # location of data area", di,