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

cov: validate count is bigger then 0

To avoid teoretical underflow...
This commit is contained in:
Zdenek Kabelac 2024-03-29 00:07:38 +01:00
parent 466265eaa6
commit a98709aeae
2 changed files with 6 additions and 4 deletions

View File

@ -4416,8 +4416,9 @@ static int _sort_rows(struct dm_report *rh)
qsort(rows, count, sizeof(**rows), _row_compare);
dm_list_init(&rh->rows);
while (count--)
dm_list_add_h(&rh->rows, &(*rows)[count]->list);
while (count > 0)
dm_list_add_h(&rh->rows, &(*rows)[--count]->list);
return 1;
}

View File

@ -4415,8 +4415,9 @@ static int _sort_rows(struct dm_report *rh)
qsort(rows, count, sizeof(**rows), _row_compare);
dm_list_init(&rh->rows);
while (count--)
dm_list_add_h(&rh->rows, &(*rows)[count]->list);
while (count > 0)
dm_list_add_h(&rh->rows, &(*rows)[--count]->list);
return 1;
}