[Devel] [PATCH hci-8.1] dm-ploop: fix u32 overflow of the delta BAT byte size
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Oct 29 13:35:03 MSK 2026
Applied with two small changes on commit, no need to resend.
1. Added
Fixes: 6ddad5a4d226 ("dm-ploop: Add ploop target driver")
2. Changed the message of the new check in ploop_resize(). After the
patch the function prints the same text from two different checks:
} else if (SEC_TO_CLU(ploop, new_sectors) >= U32_MAX - 2) {
DMWARN("resize: too large size is requested");
return -EINVAL;
...
nr_bat_entries = SEC_TO_CLU(ploop, new_sectors);
nr_bat_clusters = ploop_nr_bat_clusters(ploop, nr_bat_entries);
if ((u64)nr_bat_clusters + nr_bat_entries > PLOOP_MAX_HB_NR) {
DMWARN("resize: too large size is requested");
return -EINVAL;
}
Both checks are needed: the first one runs on sector_t and guards the
u32 truncation of nr_bat_entries, the second one bounds hb_nr. But with
the same text the log does not tell which one fired, and the first check
looks redundant next to the second one. So the new check now says what
does not fit, matching "Too large BAT" in ploop_setup_metadata():
DMWARN("resize: too large BAT");
--
Best regards,
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
More information about the Devel
mailing list