staging: rdma: Use kcalloc instead of kzalloc
PATCH v3 1/1 staging: rdma: Use kcalloc instead of kzalloc
Use kcalloc rather than kzalloc when multiplied with size to prevent integer overflows. This change also makes code nicer to read.
---
Changes since v2:
* Moved GFP_KERNEL to the previous line as it fits there.
drivers/staging/rdma/hfi1/efivar.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rdma/hfi1/efivar.c +1 -2
@@ -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 =kcalloc (strlen (name) +1 ,sizeof (efi_char16_t), -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) {
Signature · 1 line
2.5.0
Quoted 16 lines · Janani Ravichandran
Use kcalloc rather than kzalloc when multiplied with size to prevent integer overflows. This change also makes code nicer to read.
Signed-off-by Janani Ravichandran <[email protected]>---
Changes since v2:
* MovedGFP_KERNELto the previous line as it fits there.drivers/staging/rdma/hfi1/efivar.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/staging/rdma/hfi1/efivar.c +0
-0
drivers/staging/rdma/hfi1/efivar.c static int read_efi_var(const char *name, unsigned long *size, · line 86
Quoted 6 lines
drivers/staging/rdma/hfi1/efivar.c +1
-2@@ -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 =kcalloc (strlen (name) +1 ,sizeof (efi_char16_t), -GFP_KERNEL ); + uni_name =kcalloc (strlen (name) +1 ,sizeof (efi_char16_t),GFP_KERNEL );
This is a change since your previous patch. It should be the change since Greg's tree. Greg isn't going to apply the different version of your patch one by one, but rather only the one with the largest v number.
julia
Quoted 13 lines
drivers/staging/rdma/hfi1/efivar.c +0
-1temp_buffer =kzalloc (EFI_DATA_SIZE ,GFP_KERNEL );if (!uni_name || !temp_buffer) { --2.5.0
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160209210029.GA8305%40janani-Inspiron-3521.
For more options, visit https://groups.google.com/d/optout.
Greg KH
maintainerQuoted 2 lines · Janani Ravichandran
Use kcalloc rather than kzalloc when multiplied with size to prevent integer overflows. This change also makes code nicer to read.
But that's not what this patch does:
Quoted 14 lines
Signed-off-by Janani Ravichandran <[email protected]>---
Changes since v2:
* MovedGFP_KERNELto the previous line as it fits there.drivers/staging/rdma/hfi1/efivar.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/staging/rdma/hfi1/efivar.c +0
-0
drivers/staging/rdma/hfi1/efivar.c static int read_efi_var(const char *name, unsigned long *size, · line 86
Quoted 6 lines
drivers/staging/rdma/hfi1/efivar.c +1
-2@@ -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 =kcalloc (strlen (name) +1 ,sizeof (efi_char16_t), -GFP_KERNEL ); + uni_name =kcalloc (strlen (name) +1 ,sizeof (efi_char16_t),GFP_KERNEL );
You aren't calling kzalloc :(
Did you make this patch on top of something else accidentally?
thanks,
greg k-h
Quoted 26 lines · gregkh
Quoted 2 lines · Janani Ravichandran
Use kcalloc rather than kzalloc when multiplied with size to prevent integer overflows. This change also makes code nicer to read.
But that's not what this patch does:
Review
Quoted 10 lines
Signed-off-by Janani Ravichandran <[email protected] <javascript:>>---
Changes since v2:
* MovedGFP_KERNELto the previous line as it fits there.drivers/staging/rdma/hfi1/efivar.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/staging/rdma/hfi1/efivar.cdrivers/staging/rdma/hfi1/efivar.c static int read_efi_var(const char *name, unsigned
Quoted 4 lines
index b8711f3..e569f9f 100644
drivers/staging/rdma/hfi1/efivar.c +0
-0@@ -83,8 +83,7 @@ static int read_efi_var(const char *name, unsignedlong *size,
Quoted 3 lines
drivers/staging/rdma/hfi1/efivar.c +0
-0if (!efi_enabled (EFI_RUNTIME_SERVICES ))return -EOPNOTSUPP ;
Quoted 9 lines
drivers/staging/rdma/hfi1/efivar.c static int read_efi_var(const char *name, unsigned long *size,
Quoted 3 lines
drivers/staging/rdma/hfi1/efivar.c +1
-2- uni_name =kcalloc (strlen (name) +1 ,sizeof (efi_char16_t), -GFP_KERNEL ); + uni_name = kcalloc(strlen(name) + 1, sizeof(efi_char16_t),
GFP_KERNEL);You aren't calling kzalloc :(
Did you make this patch on top of something else accidentally?
Yes, Greg. That's what I seem to have done. Will send the correct one. I'm sorry.
Quoted 5 lines
thanks,
greg k-h