mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cov: overflow before widen
Evaluate as 64bit arithmetic (instead of doing 32bit mults which can in this case purely teoretically overflow).
This commit is contained in:
parent
bc1976011a
commit
c7789daec0
@ -623,7 +623,7 @@ static void _degrade_to_n48(struct node256 *n256, struct value *result)
|
||||
}
|
||||
|
||||
// Removes an entry in an array by sliding the values above it down.
|
||||
static void _erase_elt(void *array, unsigned obj_size, unsigned count, unsigned index)
|
||||
static void _erase_elt(void *array, size_t obj_size, unsigned count, unsigned index)
|
||||
{
|
||||
if (index == (count - 1))
|
||||
// The simple case
|
||||
|
@ -389,7 +389,7 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg,
|
||||
.resize = LV_EXTEND,
|
||||
.force = 1,
|
||||
};
|
||||
int i;
|
||||
uint64_t i;
|
||||
|
||||
extend_bytes = extend_mb * ONE_MB_IN_BYTES;
|
||||
extend_sectors = extend_bytes / SECTOR_SIZE;
|
||||
@ -443,8 +443,8 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg,
|
||||
|
||||
for (i = 0; i < extend_mb; i++) {
|
||||
if (!dev_write_zeros(dev, old_size_bytes + (i * ONE_MB_IN_BYTES), ONE_MB_IN_BYTES)) {
|
||||
log_error("Extend sanlock LV %s cannot zero device at %llu.", display_lvname(lv),
|
||||
(unsigned long long)(old_size_bytes + i * ONE_MB_IN_BYTES));
|
||||
log_error("Extend sanlock LV %s cannot zero device at " FMTu64 ".",
|
||||
display_lvname(lv), (old_size_bytes + i * ONE_MB_IN_BYTES));
|
||||
label_scan_invalidate(dev);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user