Commit 5a267953 authored by Janani Ravichandran's avatar Janani Ravichandran Committed by Greg Kroah-Hartman

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: default avatarJanani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b3232842
...@@ -83,8 +83,7 @@ static int read_efi_var(const char *name, unsigned long *size, ...@@ -83,8 +83,7 @@ static int read_efi_var(const char *name, unsigned long *size,
if (!efi_enabled(EFI_RUNTIME_SERVICES)) if (!efi_enabled(EFI_RUNTIME_SERVICES))
return -EOPNOTSUPP; return -EOPNOTSUPP;
uni_name = kzalloc(sizeof(efi_char16_t) * (strlen(name) + 1), uni_name = kcalloc(strlen(name) + 1, sizeof(efi_char16_t), GFP_KERNEL);
GFP_KERNEL);
temp_buffer = kzalloc(EFI_DATA_SIZE, GFP_KERNEL); temp_buffer = kzalloc(EFI_DATA_SIZE, GFP_KERNEL);
if (!uni_name || !temp_buffer) { if (!uni_name || !temp_buffer) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment