staging: rtl8192u: Use kmalloc_array instead of kmalloc
PATCH v3 1/1 staging: rtl8192u: Use kmalloc_array instead of kmalloc
Use kmalloc_array instead of kmalloc for arrays. The Coccinelle patch for this conversion is:
@@
type T;
expression F;
constant FLAG;
@@
- kmalloc(sizeof(T)*F, FLAG)
+ kmalloc_array(F, sizeof(T), FLAG)
---
Changes since v2:
* Changed the coccinelle patch in the commit description to something more robust as suggested by Julia.
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 26 lines · Janani Ravichandran
Use
kmalloc_arrayinstead of kmalloc for arrays. The Coccinelle patch for this conversion is:@@
type T;
expression F;
constant FLAG;
@@-
kmalloc(sizeof(T)*F, FLAG)
+kmalloc_array(F, sizeof(T), FLAG)Signed-off-by Janani Ravichandran <[email protected]>---
Changes since v2:
* Changed the coccinelle patch in the commit description to something more robust as suggested by Julia.drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +0
-0
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c static void RxReorderIndicatePacket(struct ieee80211_device *ieee, · line 604
Quoted 6 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +1
-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,
I commented on v2 as I didn't see v3 already sent.
quoting my previous mail:
"something is wrong. coccinelle should not change REORDER_WIN_SIZE to RECORDER_WIN_SIZE.
and you did not build tested it before sending."
regards
sudip
Quoted 11 lines · Janani Ravichandran
Use
kmalloc_arrayinstead of kmalloc for arrays. The Coccinelle patch for this conversion is:@@
type T;
expression F;
constant FLAG;
@@-
kmalloc(sizeof(T)*F, FLAG)
+kmalloc_array(F, sizeof(T), FLAG)
The semantic patch looks better, but there is still the spelling mistake in the code.
julia
Quoted 35 lines
Signed-off-by Janani Ravichandran <[email protected]>---
Changes since v2:
* Changed the coccinelle patch in the commit description to something more robust as suggested by Julia.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/20160210035121.GA2786%40janani-Inspiron-3521. For more options, visit https://groups.google.com/d/optout.