All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Outreachy kernel] [PATCH v3] staging: rdma: Use kcalloc instead of kzalloc
  2016-02-09 21:00 [PATCH v3] staging: rdma: Use kcalloc instead of kzalloc Janani Ravichandran
@ 2016-02-09 16:05 ` Julia Lawall
  2016-02-09 16:23 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2016-02-09 16:05 UTC (permalink / raw)
  To: Janani Ravichandran; +Cc: outreachy-kernel



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 <janani.rvchndrn@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c
> index b8711f3..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 = 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

>  	temp_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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Outreachy kernel] [PATCH v3] staging: rdma: Use kcalloc instead of kzalloc
  2016-02-09 21:00 [PATCH v3] staging: rdma: Use kcalloc instead of kzalloc Janani Ravichandran
  2016-02-09 16:05 ` [Outreachy kernel] " Julia Lawall
@ 2016-02-09 16:23 ` Greg KH
  2016-02-09 16:34   ` Janani Ravichandran
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2016-02-09 16:23 UTC (permalink / raw)
  To: Janani Ravichandran; +Cc: outreachy-kernel

On Tue, Feb 09, 2016 at 04:00:29PM -0500, Janani Ravichandran wrote:
> 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:

> 
> Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
> ---
> 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(-)
> 
> diff --git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c
> index b8711f3..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 = 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Outreachy kernel] [PATCH v3] staging: rdma: Use kcalloc instead of kzalloc
  2016-02-09 16:23 ` Greg KH
@ 2016-02-09 16:34   ` Janani Ravichandran
  0 siblings, 0 replies; 4+ messages in thread
From: Janani Ravichandran @ 2016-02-09 16:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: janani.rvchndrn


[-- Attachment #1.1: Type: text/plain, Size: 1448 bytes --]



On Tuesday, 9 February 2016 11:23:28 UTC-5, gregkh wrote:
>
> On Tue, Feb 09, 2016 at 04:00:29PM -0500, Janani Ravichandran wrote: 
> > 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: 
>
> > 
> > Signed-off-by: Janani Ravichandran <janani....@gmail.com <javascript:>> 
> > --- 
> > 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(-) 
> > 
> > diff --git a/drivers/staging/rdma/hfi1/efivar.c 
> b/drivers/staging/rdma/hfi1/efivar.c 
> > index b8711f3..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 = 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. 

>
> thanks, 
>
> greg k-h 
>

[-- Attachment #1.2: Type: text/html, Size: 2196 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3] staging: rdma: Use kcalloc instead of kzalloc
@ 2016-02-09 21:00 Janani Ravichandran
  2016-02-09 16:05 ` [Outreachy kernel] " Julia Lawall
  2016-02-09 16:23 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Janani Ravichandran @ 2016-02-09 21:00 UTC (permalink / raw)
  To: outreachy-kernel

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 <janani.rvchndrn@gmail.com>
---
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(-)

diff --git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c
index b8711f3..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 = 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) {
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-09 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-09 21:00 [PATCH v3] staging: rdma: Use kcalloc instead of kzalloc Janani Ravichandran
2016-02-09 16:05 ` [Outreachy kernel] " Julia Lawall
2016-02-09 16:23 ` Greg KH
2016-02-09 16:34   ` Janani Ravichandran

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.