]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mtd: jedec_probe: use struct_size() helper for cfiq allocation
authorRahul Kumar <rk0006818@gmail.com>
Mon, 22 Sep 2025 07:11:37 +0000 (12:41 +0530)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 29 Sep 2025 16:01:43 +0000 (18:01 +0200)
commit527668868862e0db65efc88fe82040f1e48d4ab3
tree4b91033afa2928525fa1c816a2edac5a1fa00f93
parentd496b6f42eb0455caf5d8cb30cf1f01b7fc2a747
mtd: jedec_probe: use struct_size() helper for cfiq allocation

Documentation/process/deprecated.rst recommends against performing
dynamic size calculations in the arguments of memory allocator
functions due to the risk of overflow. Such calculations can wrap
around and result in a smaller allocation than expected.

Replace the size calculation in cfiq allocation with struct_size()
helper to make the code clearer and handle overflows correctly.

Signed-off-by: Rahul Kumar <rk0006818@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/chips/jedec_probe.c