linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] iwlwifi: silence buffer overflow warning
@ 2010-01-09  8:41 Dan Carpenter
  2010-01-11  1:50 ` Zhu Yi
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-01-09  8:41 UTC (permalink / raw)
  To: Zhu Yi
  Cc: Reinette Chatre, Intel Linux Wireless, John W. Linville,
	linux-wireless

Smatch (and presumably other static checkers) complain that MAX_TID_COUNT is 
past the end of the array.  In the resulting discussion, Zhu Yi pointed out
that this value is not used in real life and the assignment was only there to
silence a gcc warning.

If there were a bug in the surrounding code and the value were used, the 
WARN_ON(!qc) would print a warning before the crash.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--- orig/drivers/net/wireless/iwlwifi/iwl-4965.c	2010-01-03 11:02:42.000000000 +0300
+++ devel/drivers/net/wireless/iwlwifi/iwl-4965.c	2010-01-06 00:27:00.000000000 +0300
@@ -1961,7 +1961,7 @@ static void iwl4965_rx_reply_tx(struct i
 	struct ieee80211_tx_info *info;
 	struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
 	u32  status = le32_to_cpu(tx_resp->u.status);
-	int tid = MAX_TID_COUNT;
+	int uninitialized_var(tid);
 	int sta_id;
 	int freed;
 	u8 *qc = NULL;

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

* Re: [patch] iwlwifi: silence buffer overflow warning
  2010-01-09  8:41 [patch] iwlwifi: silence buffer overflow warning Dan Carpenter
@ 2010-01-11  1:50 ` Zhu Yi
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu Yi @ 2010-01-11  1:50 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Chatre, Reinette, Intel Linux Wireless, John W. Linville,
	linux-wireless@vger.kernel.org

On Sat, 2010-01-09 at 16:41 +0800, Dan Carpenter wrote:
> Smatch (and presumably other static checkers) complain that MAX_TID_COUNT is 
> past the end of the array.  In the resulting discussion, Zhu Yi pointed out
> that this value is not used in real life and the assignment was only there to
> silence a gcc warning.
> 
> If there were a bug in the surrounding code and the value were used, the 
> WARN_ON(!qc) would print a warning before the crash.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Zhu Yi <yi.zhu@intel.com>

Thanks,
-yi

> --- orig/drivers/net/wireless/iwlwifi/iwl-4965.c	2010-01-03 11:02:42.000000000 +0300
> +++ devel/drivers/net/wireless/iwlwifi/iwl-4965.c	2010-01-06 00:27:00.000000000 +0300
> @@ -1961,7 +1961,7 @@ static void iwl4965_rx_reply_tx(struct i
>  	struct ieee80211_tx_info *info;
>  	struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
>  	u32  status = le32_to_cpu(tx_resp->u.status);
> -	int tid = MAX_TID_COUNT;
> +	int uninitialized_var(tid);
>  	int sta_id;
>  	int freed;
>  	u8 *qc = NULL;



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

end of thread, other threads:[~2010-01-11  1:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-09  8:41 [patch] iwlwifi: silence buffer overflow warning Dan Carpenter
2010-01-11  1:50 ` Zhu Yi

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).