Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | From | Edward Adam Davis <> | Subject | Re: [syzbot] [mtd?] WARNING: zero-size vmalloc in ubi_read_volume_table | Date | Tue, 2 Apr 2024 12:10:58 +0800 |
| |
please test zs in ubi_read_volume_table
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index f700f0e4f2ec..e3b337afdb4f 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c @@ -791,7 +791,8 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai) * The number of supported volumes is limited by the eraseblock size * and by the UBI_MAX_VOLUMES constant. */ - ubi->vtbl_slots = ubi->leb_size / UBI_VTBL_RECORD_SIZE; + ubi->vtbl_slots = ubi->leb_size > UBI_VTBL_RECORD_SIZE ? + ubi->leb_size / UBI_VTBL_RECORD_SIZE : 1; if (ubi->vtbl_slots > UBI_MAX_VOLUMES) ubi->vtbl_slots = UBI_MAX_VOLUMES;
| ![\](/images/icornerr.gif) |