efi: efibc: change kmalloc(size * count, ...) to kmalloc_array()
PATCH 1/1 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.
Signed-off-by Ethan Carter Edwards <[email protected]>
--- drivers/firmware/efi/efibc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/efibc.c +1 -1
@@ -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 ;
---
base-commit: 0a2f889128969dab41861b6e40111aa03dc57014
change-id: 20250308-efibc-kmalloc_array-ba78097a0708
Best regards,
Signature · 1 line
Ethan Carter Edwards <[email protected]>
Quoted 26 lines · Ethan Carter Edwards
Open coded arithmetic in allocator arguments is discouraged. Helper functions like kcalloc or, in this case,
kmalloc_arrayare preferred.Signed-off-by Ethan Carter Edwards <[email protected]>--- drivers/firmware/efi/efibc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/firmware/efi/efibc.c +1
-2@@ -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 ; ---
Quoted 3 lines
base-commit:
0a2f889128969dab41861b6e40111aa03dc57014
change-id: 20250308-efibc-kmalloc_array-ba78097a0708
Queued up in efi/next, thanks.