staging: rdma: Use kcalloc instead of kzalloc
PATCH v2 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 v1:
* Removed unneeded parentheses around kzalloc's first parameter
drivers/staging/rdma/hfi1/efivar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rdma/hfi1/efivar.c +1 -1
@@ -83,7 +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), + uni_name =kcalloc (strlen (name) +1 ,sizeof (efi_char16_t),GFP_KERNEL ); temp_buffer =kzalloc (EFI_DATA_SIZE ,GFP_KERNEL );
Signature · 1 line
2.5.0
Quoted 7 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 v1:
* Removed unneeded parentheses around kzalloc's first parameter
You don't have to send a v3 for this, but it would be nicer to put a blank line between this comment and the diffstat information.
I wonder though if GFP_KERNEL would now fit on the same line with the rest?
julia
Quoted 26 lines
drivers/staging/rdma/hfi1/efivar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/rdma/hfi1/efivar.c +1
-2@@ -83,7 +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), + uni_name =kcalloc (strlen (name) +1 ,sizeof (efi_char16_t),GFP_KERNEL ); temp_buffer =kzalloc (EFI_DATA_SIZE ,GFP_KERNEL ); --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/20160209201046.GA6794%40janani-Inspiron-3521.
For more options, visit https://groups.google.com/d/optout.
Quoted 10 lines · Julia Lawall
Quoted 7 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 v1:
* Removed unneeded parentheses around kzalloc's first parameter
Quoted 6 lines
You don't have to send a v3 for this, but it would be nicer to put a blank line between this comment and the diffstat information.
I wonder though if
GFP_KERNELwould now fit on the same line with the rest?
It actually does, Julia, the statement ends at column 79 if when I fit GFP_KERNEL on the same line. Do I make this change and send a v3?
Quoted 36 lines
julia
Review
Quoted 4 lines
drivers/staging/rdma/hfi1/efivar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(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 feef163..b8711f3 100644
drivers/staging/rdma/hfi1/efivar.c +0
-0@@ -83,7 +83,7 @@ static int read_efi_var(const char *name, unsignedlong *size,
Quoted 11 lines
drivers/staging/rdma/hfi1/efivar.c +1
-2if (!efi_enabled (EFI_RUNTIME_SERVICES ))return -EOPNOTSUPP ; - uni_name =kcalloc ((strlen (name) +1 ),sizeof (efi_char16_t), + uni_name =kcalloc (strlen (name) +1 ,sizeof (efi_char16_t),GFP_KERNEL ); temp_buffer =kzalloc (EFI_DATA_SIZE ,GFP_KERNEL ); --2.5.0
Quoted 2 lines
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
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/20160209201046.GA6794%40janani-Inspiron-3521
.Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
Quoted 19 lines · Janani Ravichandran
On Tue, Feb 9, 2016 at 10:23 AM, Julia Lawall <[email protected]> wrote:
On Tue, 9 Feb 2016, Janani Ravichandran wrote:> 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 v1:
> * Removed unneeded parentheses around kzalloc's first parameterYou don't have to send a v3 for this, but it would be nicer to put a blank
line between this comment and the diffstat information.
Quoted 6 lines
I wonder though if
GFP_KERNELwould now fit on the same line with the
rest?It actually does, Julia, the statement ends at column 79 if when I fit
GFP_KERNELon the same line. Do I make this change and send a v3?
Yes.
julia