]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
efi: efibc: change kmalloc(size * count, ...) to kmalloc_array()
authorEthan Carter Edwards <ethan@ethancedwards.com>
Sun, 9 Mar 2025 01:27:41 +0000 (20:27 -0500)
committerArd Biesheuvel <ardb@kernel.org>
Mon, 10 Mar 2025 17:22:47 +0000 (18:22 +0100)
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>
drivers/firmware/efi/efibc.c

index 4f9fb086eab7b0e22252d22e59e5aae55865322d..0a7c764dcc614fbba3cbcd94183dc07939837a03 100644 (file)
@@ -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;