linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192u: fix large frame size compiler warning
@ 2015-12-16 20:55 Okash Khawaja
  2015-12-16 21:02 ` Okash Khawaja
  2015-12-16 21:15 ` Okash Khawaja
  0 siblings, 2 replies; 7+ messages in thread
From: Okash Khawaja @ 2015-12-16 20:55 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Compiling drivers/staging/rtl8192u/ gives following compiler warning:

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function
‘RxReorderIndicatePacket’:
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:758:1: warning: the
frame size of 1064 bytes is larger than 1024 bytes
[-Wframe-larger-than=]

This patch fixes it by replacing the statically allocated array
`prxbIndicateArray` with kmalloc'd one.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 130c852..d89e99a 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -594,12 +594,22 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
 {
 	PRT_HIGH_THROUGHPUT	pHTInfo = ieee->pHTInfo;
 	PRX_REORDER_ENTRY	pReorderEntry = NULL;
-	struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
+	struct ieee80211_rxb **prxbIndicateArray;
 	u8			WinSize = pHTInfo->RxReorderWinSize;
 	u16			WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096;
 	u8			index = 0;
 	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);
+	if (!prxbIndicateArray) {
+		IEEE80211_DEBUG(IEEE80211_DL_ERR,
+				"%s(): kmalloc prxbIndicateArray error\n",
+				__func__);
+		return;
+	}
+
 	/* Rx Reorder initialize condition.*/
 	if (pTS->RxIndicateSeq == 0xffff) {
 		pTS->RxIndicateSeq = SeqNum;
-- 
2.5.2


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

* Re: [PATCH] staging: rtl8192u: fix large frame size compiler warning
  2015-12-16 20:55 [PATCH] staging: rtl8192u: fix large frame size compiler warning Okash Khawaja
@ 2015-12-16 21:02 ` Okash Khawaja
  2015-12-16 21:15 ` Okash Khawaja
  1 sibling, 0 replies; 7+ messages in thread
From: Okash Khawaja @ 2015-12-16 21:02 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

On Wed, Dec 16, 2015 at 08:55:45PM +0000, Okash Khawaja wrote:
> Compiling drivers/staging/rtl8192u/ gives following compiler warning:
> 
> drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function
> ‘RxReorderIndicatePacket’:
> drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:758:1: warning: the
> frame size of 1064 bytes is larger than 1024 bytes
> [-Wframe-larger-than=]
> 
> This patch fixes it by replacing the statically allocated array
> `prxbIndicateArray` with kmalloc'd one.
> 
> Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> index 130c852..d89e99a 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> @@ -594,12 +594,22 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
>  {
>  	PRT_HIGH_THROUGHPUT	pHTInfo = ieee->pHTInfo;
>  	PRX_REORDER_ENTRY	pReorderEntry = NULL;
> -	struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
> +	struct ieee80211_rxb **prxbIndicateArray;
>  	u8			WinSize = pHTInfo->RxReorderWinSize;
>  	u16			WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096;
>  	u8			index = 0;
>  	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);
> +	if (!prxbIndicateArray) {
> +		IEEE80211_DEBUG(IEEE80211_DL_ERR,
> +				"%s(): kmalloc prxbIndicateArray error\n",
> +				__func__);
> +		return;
> +	}
> +
>  	/* Rx Reorder initialize condition.*/
>  	if (pTS->RxIndicateSeq == 0xffff) {
>  		pTS->RxIndicateSeq = SeqNum;
> -- 
> 2.5.2
>

This doesn't free the kmalloc'd array. Please ignore this. I'll send
another version of this patch.

Thanks

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

* [PATCH] staging: rtl8192u: fix large frame size compiler warning
  2015-12-16 20:55 [PATCH] staging: rtl8192u: fix large frame size compiler warning Okash Khawaja
  2015-12-16 21:02 ` Okash Khawaja
@ 2015-12-16 21:15 ` Okash Khawaja
  2015-12-17 11:04   ` Dan Carpenter
  1 sibling, 1 reply; 7+ messages in thread
From: Okash Khawaja @ 2015-12-16 21:15 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

This patch fixes following compiler warning:

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function
‘RxReorderIndicatePacket’:
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:758:1: warning: the
frame size of 1064 bytes is larger than 1024 bytes
[-Wframe-larger-than=]

It replaces the statically allocated array prxbIndicateArray with
a kmalloc'd one.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 130c852..77eed52 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -594,12 +594,22 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
 {
 	PRT_HIGH_THROUGHPUT	pHTInfo = ieee->pHTInfo;
 	PRX_REORDER_ENTRY	pReorderEntry = NULL;
-	struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
+	struct ieee80211_rxb **prxbIndicateArray;
 	u8			WinSize = pHTInfo->RxReorderWinSize;
 	u16			WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096;
 	u8			index = 0;
 	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);
+	if (!prxbIndicateArray) {
+		IEEE80211_DEBUG(IEEE80211_DL_ERR,
+				"%s(): kmalloc prxbIndicateArray error\n",
+				__func__);
+		return;
+	}
+
 	/* Rx Reorder initialize condition.*/
 	if (pTS->RxIndicateSeq == 0xffff) {
 		pTS->RxIndicateSeq = SeqNum;
@@ -618,6 +628,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
 			kfree(prxb);
 			prxb = NULL;
 		}
+
+		kfree(prxbIndicateArray);
 		return;
 	}
 
@@ -741,6 +753,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
 		// Indicate packets
 		if(index>REORDER_WIN_SIZE){
 			IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorer buffer full!! \n");
+			kfree(prxbIndicateArray);
 			return;
 		}
 		ieee80211_indicate_packets(ieee, prxbIndicateArray, index);
-- 
2.5.2


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

* Re: [PATCH] staging: rtl8192u: fix large frame size compiler warning
  2015-12-16 21:15 ` Okash Khawaja
@ 2015-12-17 11:04   ` Dan Carpenter
  2015-12-17 20:30     ` [PATCH v4] " Okash Khawaja
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2015-12-17 11:04 UTC (permalink / raw)
  To: Okash Khawaja; +Cc: gregkh, devel, linux-kernel

Put a v3 in the subject.

There are still paths where this is not freed, so we need a v4.  Take
your time, there is no rush.

>  drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> index 130c852..77eed52 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> @@ -594,12 +594,22 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
>  {
>  	PRT_HIGH_THROUGHPUT	pHTInfo = ieee->pHTInfo;
>  	PRX_REORDER_ENTRY	pReorderEntry = NULL;
> -	struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
> +	struct ieee80211_rxb **prxbIndicateArray;
>  	u8			WinSize = pHTInfo->RxReorderWinSize;
>  	u16			WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096;
>  	u8			index = 0;
>  	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);
> +	if (!prxbIndicateArray) {
> +		IEEE80211_DEBUG(IEEE80211_DL_ERR,
> +				"%s(): kmalloc prxbIndicateArray error\n",
> +				__func__);

Don't print an error if kmalloc() fails.  kmalloc has its own message.

> +		return;
> +	}

regards,
dan carpenter


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

* [PATCH v4] staging: rtl8192u: fix large frame size compiler warning
  2015-12-17 11:04   ` Dan Carpenter
@ 2015-12-17 20:30     ` Okash Khawaja
  2015-12-22 12:45       ` Okash Khawaja
  0 siblings, 1 reply; 7+ messages in thread
From: Okash Khawaja @ 2015-12-17 20:30 UTC (permalink / raw)
  To: dan.carpenter, gregkh; +Cc: devel, linux-kernel

This patch fixes following compiler warning:

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function
‘RxReorderIndicatePacket’:
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:758:1: warning: the
frame size of 1064 bytes is larger than 1024 bytes
[-Wframe-larger-than=]

It replaces the statically allocated array prxbIndicateArray with
a kmalloc'd one.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 130c852..28ad63a 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -594,12 +594,18 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
 {
 	PRT_HIGH_THROUGHPUT	pHTInfo = ieee->pHTInfo;
 	PRX_REORDER_ENTRY	pReorderEntry = NULL;
-	struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
+	struct ieee80211_rxb **prxbIndicateArray;
 	u8			WinSize = pHTInfo->RxReorderWinSize;
 	u16			WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096;
 	u8			index = 0;
 	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);
+	if (!prxbIndicateArray)
+		return;
+
 	/* Rx Reorder initialize condition.*/
 	if (pTS->RxIndicateSeq == 0xffff) {
 		pTS->RxIndicateSeq = SeqNum;
@@ -618,6 +624,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
 			kfree(prxb);
 			prxb = NULL;
 		}
+
+		kfree(prxbIndicateArray);
 		return;
 	}
 
@@ -741,6 +749,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
 		// Indicate packets
 		if(index>REORDER_WIN_SIZE){
 			IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorer buffer full!! \n");
+			kfree(prxbIndicateArray);
 			return;
 		}
 		ieee80211_indicate_packets(ieee, prxbIndicateArray, index);
@@ -755,6 +764,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
 		pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime);
 		add_timer(&pTS->RxPktPendingTimer);
 	}
+
+	kfree(prxbIndicateArray);
 }
 
 static u8 parse_subframe(struct sk_buff *skb,
-- 
2.5.2


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

* Re: [PATCH v4] staging: rtl8192u: fix large frame size compiler warning
  2015-12-17 20:30     ` [PATCH v4] " Okash Khawaja
@ 2015-12-22 12:45       ` Okash Khawaja
  2015-12-22 13:24         ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Okash Khawaja @ 2015-12-22 12:45 UTC (permalink / raw)
  To: dan.carpenter, gregkh; +Cc: devel, linux-kernel

On Thu, Dec 17, 2015 at 08:30:38PM +0000, Okash Khawaja wrote:
> This patch fixes following compiler warning:
> 
> drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function
> ‘RxReorderIndicatePacket’:
> drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:758:1: warning: the
> frame size of 1064 bytes is larger than 1024 bytes
> [-Wframe-larger-than=]
> 
> It replaces the statically allocated array prxbIndicateArray with
> a kmalloc'd one.
> 
> Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> index 130c852..28ad63a 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> @@ -594,12 +594,18 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
>  {
>  	PRT_HIGH_THROUGHPUT	pHTInfo = ieee->pHTInfo;
>  	PRX_REORDER_ENTRY	pReorderEntry = NULL;
> -	struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
> +	struct ieee80211_rxb **prxbIndicateArray;
>  	u8			WinSize = pHTInfo->RxReorderWinSize;
>  	u16			WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096;
>  	u8			index = 0;
>  	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);
> +	if (!prxbIndicateArray)
> +		return;
> +
>  	/* Rx Reorder initialize condition.*/
>  	if (pTS->RxIndicateSeq == 0xffff) {
>  		pTS->RxIndicateSeq = SeqNum;
> @@ -618,6 +624,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
>  			kfree(prxb);
>  			prxb = NULL;
>  		}
> +
> +		kfree(prxbIndicateArray);
>  		return;
>  	}
>  
> @@ -741,6 +749,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
>  		// Indicate packets
>  		if(index>REORDER_WIN_SIZE){
>  			IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorer buffer full!! \n");
> +			kfree(prxbIndicateArray);
>  			return;
>  		}
>  		ieee80211_indicate_packets(ieee, prxbIndicateArray, index);
> @@ -755,6 +764,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee,
>  		pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime);
>  		add_timer(&pTS->RxPktPendingTimer);
>  	}
> +
> +	kfree(prxbIndicateArray);
>  }
>  
>  static u8 parse_subframe(struct sk_buff *skb,
> -- 
> 2.5.2
> 
Hi,

Has a return path been missed out now?

Thanks,
Okash

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

* Re: [PATCH v4] staging: rtl8192u: fix large frame size compiler warning
  2015-12-22 12:45       ` Okash Khawaja
@ 2015-12-22 13:24         ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2015-12-22 13:24 UTC (permalink / raw)
  To: Okash Khawaja; +Cc: gregkh, devel, linux-kernel

Looks ok.

Greg is working through his inbox.  It will take a little while for him
to get to your patch.  Be patient.

regards,
dan carpenter


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

end of thread, other threads:[~2015-12-22 13:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-16 20:55 [PATCH] staging: rtl8192u: fix large frame size compiler warning Okash Khawaja
2015-12-16 21:02 ` Okash Khawaja
2015-12-16 21:15 ` Okash Khawaja
2015-12-17 11:04   ` Dan Carpenter
2015-12-17 20:30     ` [PATCH v4] " Okash Khawaja
2015-12-22 12:45       ` Okash Khawaja
2015-12-22 13:24         ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).