Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

efi: efibc: change kmalloc(size * count, ...) to kmalloc_array()

Open coded arithmetic in allocator arguments is discouraged. Helper
functions like kcalloc or, in this case, kmalloc_array are preferred.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments

Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

authored by

Ethan Carter Edwards and committed by
Ard Biesheuvel
ac2efaa8 b6b227e3

+1 -1
+1 -1
drivers/firmware/efi/efibc.c
··· 47 47 if (ret || !data) 48 48 return NOTIFY_DONE; 49 49 50 - wdata = kmalloc(MAX_DATA_LEN * sizeof(efi_char16_t), GFP_KERNEL); 50 + wdata = kmalloc_array(MAX_DATA_LEN, sizeof(efi_char16_t), GFP_KERNEL); 51 51 if (!wdata) 52 52 return NOTIFY_DONE; 53 53