staging: rtl8192u: Use kmalloc_array instead of kmalloc
PATCH 1/1 staging: rtl8192u: Use kmalloc_array instead of kmalloc
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 <[email protected]>
--- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +2 -2
@@ -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 ;
Signature · 1 line
2.5.0
Quoted 9 lines · Janani Ravichandran
Use
kmalloc_arrayinstead 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
Quoted 31 lines
Signed-off-by Janani Ravichandran <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +2
-2@@ -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 ;Signature · 8 lines
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/20160209235837.GA11402%40janani-Inspiron-3521. For more options, visit https://groups.google.com/d/optout.