All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Outreachy kernel] [PATCH] staging: rtl8192u: Use kmalloc_array instead of kmalloc
  2016-02-09 23:58 [PATCH] staging: rtl8192u: Use kmalloc_array instead of kmalloc Janani Ravichandran
@ 2016-02-09 21:54 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2016-02-09 21:54 UTC (permalink / raw)
  To: Janani Ravichandran; +Cc: outreachy-kernel

On Tue, 9 Feb 2016, Janani Ravichandran wrote:

> Use kmalloc_array instead of kmalloc for arrays. Coccinelle patch used:
> 
> @@
> expression E, F;
> constant FLAG;
> @@
> 
> - kmalloc(E*F, FLAG)
> + kmalloc(E, F, FLAG)

You have the wrong function call in the + case here.

julia

> 
> Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> index 28ad63a..fb344d1 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> @@ -601,8 +601,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
>  	bool			bMatchWinStart = false, bPktInBuf = false;
>  	IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__func__,SeqNum,pTS->RxIndicateSeq,WinSize);
>  
> -	prxbIndicateArray = kmalloc(sizeof(struct ieee80211_rxb *) *
> -			REORDER_WIN_SIZE, GFP_KERNEL);
> +	prxbIndicateArray = kmalloc_array(RECORDER_WIN_SIZE,
> +			sizeof(struct ieee80211_rxb *), GFP_KERNEL);
>  	if (!prxbIndicateArray)
>  		return;
>  
> -- 
> 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/20160209235837.GA11402%40janani-Inspiron-3521.
> For more options, visit https://groups.google.com/d/optout.
> 


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

* [PATCH] staging: rtl8192u: Use kmalloc_array instead of kmalloc
@ 2016-02-09 23:58 Janani Ravichandran
  2016-02-09 21:54 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Janani Ravichandran @ 2016-02-09 23:58 UTC (permalink / raw)
  To: outreachy-kernel

Use kmalloc_array instead of kmalloc for arrays. Coccinelle patch used:

@@
expression E, F;
constant FLAG;
@@

- kmalloc(E*F, FLAG)
+ kmalloc(E, F, FLAG)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 28ad63a..fb344d1 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -601,8 +601,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
 	bool			bMatchWinStart = false, bPktInBuf = false;
 	IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__func__,SeqNum,pTS->RxIndicateSeq,WinSize);
 
-	prxbIndicateArray = kmalloc(sizeof(struct ieee80211_rxb *) *
-			REORDER_WIN_SIZE, GFP_KERNEL);
+	prxbIndicateArray = kmalloc_array(RECORDER_WIN_SIZE,
+			sizeof(struct ieee80211_rxb *), GFP_KERNEL);
 	if (!prxbIndicateArray)
 		return;
 
-- 
2.5.0



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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09 23:58 [PATCH] staging: rtl8192u: Use kmalloc_array instead of kmalloc Janani Ravichandran
2016-02-09 21:54 ` [Outreachy kernel] " Julia Lawall

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.