summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanani Ravichandran <janani.rvchndrn@gmail.com>2016-02-09 22:06:27 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-10 01:43:09 (GMT)
commit5a267953baca23c49f78a2e365aa0f44f762b0c1 (patch)
treeb66b0711a1f4385f96157836651c915e29f37da1
parentb3232842dbef8e6356af75b3a98ea7f752879bc8 (diff)
downloadlinux-5a267953baca23c49f78a2e365aa0f44f762b0c1.tar.xz
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 <janani.rvchndrn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/rdma/hfi1/efivar.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c
index 7dc5bae..e569f9f 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) {