From: Ethan Carter Edwards Date: Sun, 9 Mar 2025 01:27:41 +0000 (-0500) Subject: efi: efibc: change kmalloc(size * count, ...) to kmalloc_array() X-Git-Tag: v6.15-rc1~114^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac2efaa8455021ce1e6216457684d60a9e2c77fd;p=thirdparty%2Fkernel%2Fstable.git 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 Signed-off-by: Ard Biesheuvel --- diff --git a/drivers/firmware/efi/efibc.c b/drivers/firmware/efi/efibc.c index 4f9fb086eab7b..0a7c764dcc614 100644 --- a/drivers/firmware/efi/efibc.c +++ b/drivers/firmware/efi/efibc.c @@ -47,7 +47,7 @@ static int efibc_reboot_notifier_call(struct notifier_block *notifier, if (ret || !data) return NOTIFY_DONE; - wdata = kmalloc(MAX_DATA_LEN * sizeof(efi_char16_t), GFP_KERNEL); + wdata = kmalloc_array(MAX_DATA_LEN, sizeof(efi_char16_t), GFP_KERNEL); if (!wdata) return NOTIFY_DONE;