From 5a267953baca23c49f78a2e365aa0f44f762b0c1 Mon Sep 17 00:00:00 2001 From: Janani Ravichandran Date: Tue, 9 Feb 2016 17:06:27 -0500 Subject: [PATCH] staging: rdma: Use kcalloc instead of kzalloc Use kcalloc rather than kzalloc when multiplied by size to prevent integer overflows. This change also makes code nicer to read. Signed-off-by: Janani Ravichandran Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/efivar.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c index 7dc5bae220e0..e569f9f456c5 100644 --- a/drivers/staging/rdma/hfi1/efivar.c +++ b/drivers/staging/rdma/hfi1/efivar.c @@ -83,8 +83,7 @@ static int read_efi_var(const char *name, unsigned long *size, if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -EOPNOTSUPP; - uni_name = kzalloc(sizeof(efi_char16_t) * (strlen(name) + 1), - GFP_KERNEL); + uni_name = kcalloc(strlen(name) + 1, sizeof(efi_char16_t), GFP_KERNEL); temp_buffer = kzalloc(EFI_DATA_SIZE, GFP_KERNEL); if (!uni_name || !temp_buffer) { -- 2.39.5