diff options
author | Gopi Krishna Menon <krishnagopi487@gmail.com> | 2025-09-19 00:14:14 +0530 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2025-09-29 18:01:32 +0200 |
commit | d496b6f42eb0455caf5d8cb30cf1f01b7fc2a747 (patch) | |
tree | 872c4a2794bbbce4107fab71a55cb7b6880486ff /rust/helpers/helpers.c | |
parent | 9781c381c159523c6792b1d08d4be6055e0dbd8b (diff) |
mtd: cfi: use struct_size() helper for cfiq allocation
Documentation/process/deprecated.rst recommends against performing
dynamic size calculations in the arguments of memory allocator
function due to the risk of overflow. Such calculations can
wrap around and result in a smaller allocation than what the caller
was expecting.
Replace the size calculation in cfiq allocation with struct_size()
helper to make the code clearer and handle the overflows correctly.
Signed-off-by: Gopi Krishna Menon <krishnagopi487@gmail.com>
Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
link: https://lore.kernel.org/linux-kernel-mentees/20250922071137.900508-1-rk0006818@gmail.com/T/#u
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions