linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Spare warnings - wireless drivers
@ 2009-08-13 20:31 Luis R. Rodriguez
  2009-08-13 20:51 ` Larry Finger
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Luis R. Rodriguez @ 2009-08-13 20:31 UTC (permalink / raw)
  To: linux-wireless

b43:

  CHECK   drivers/net/wireless/b43/phy_g.c
drivers/net/wireless/b43/phy_g.c:974:56: warning: cast truncates bits
from constant value (ffff7fff becomes 7fff)

...

  CHECK   drivers/net/wireless/b43/wa.c
drivers/net/wireless/b43/wa.c:385:60: warning: cast truncates bits
from constant value (ffff00ff becomes ff)
drivers/net/wireless/b43/wa.c:403:55: warning: cast truncates bits
from constant value (ffff00ff becomes ff)
drivers/net/wireless/b43/wa.c:405:55: warning: cast truncates bits
from constant value (ffff00ff becomes ff)
drivers/net/wireless/b43/wa.c:415:71: warning: cast truncates bits
from constant value (ffff0fff becomes fff)


ip2100:

  CHECK   drivers/net/wireless/ipw2x00/ipw2100.c
include/net/inet_sock.h:208:17: warning: do-while statement is not a
compound statement
drivers/net/wireless/ipw2x00/ipw2100.c:2847:21: warning: symbol 'i'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2100.c:2770:16: originally declared here
drivers/net/wireless/ipw2x00/ipw2100.c:7888:22: warning: symbol 'mode'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2100.c:188:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2100.c:7952:18: warning: symbol 'mode'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2100.c:188:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2100.c:8000:18: warning: symbol 'mode'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2100.c:188:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2100.c:8268:27: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2100.c:8268:27: originally declared here
drivers/net/wireless/ipw2x00/ipw2100.c:8268:27: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2100.c:8268:27: originally declared here
drivers/net/wireless/ipw2x00/ipw2100.c:8268:27: warning: symbol
'_min2' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2100.c:8268:27: originally declared here
  CC [M]  drivers/net/wireless/ipw2x00/ipw2100.o
  CHECK   drivers/net/wireless/ipw2x00/ipw2200.c
  CHECK   drivers/net/wireless/ipw2x00/ipw2200.c
drivers/net/wireless/ipw2x00/ipw2200.c:847:13: warning: symbol 'led'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:92:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:891:13: warning: symbol 'led'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:92:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:935:13: warning: symbol 'led'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:92:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:980:13: warning: symbol 'led'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:92:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:1016:13: warning: symbol 'led'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:92:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:1051:13: warning: symbol 'led'
shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:92:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:1823:13: warning: symbol
'channel' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:86:12: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min2' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min2' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min2' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min2' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min2' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min2' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min2' shadows an earlier one
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: originally declared here
drivers/net/wireless/ipw2x00/ipw2200.c:4268:19: warning: symbol
'_min1' shadows an earlier one
(goes on and on)

  CC [M]  drivers/net/wireless/ipw2x00/ipw2200.o
  CHECK   drivers/net/wireless/ipw2x00/libipw_module.c
include/net/inet_sock.h:208:17: warning: do-while statement is not a
compound statement
  CC [M]  drivers/net/wireless/ipw2x00/libipw_module.o
  CHECK   drivers/net/wireless/ipw2x00/libipw_tx.c
include/net/inet_sock.h:208:17: warning: do-while statement is not a
compound statement
  CC [M]  drivers/net/wireless/ipw2x00/libipw_tx.o
  CHECK   drivers/net/wireless/ipw2x00/libipw_rx.c
include/net/inet_sock.h:208:17: warning: do-while statement is not a
compound statement
  CC [M]  drivers/net/wireless/ipw2x00/libipw_rx.o
  CHECK   drivers/net/wireless/ipw2x00/libipw_wx.c
  CC [M]  drivers/net/wireless/ipw2x00/libipw_wx.o
  CHECK   drivers/net/wireless/ipw2x00/libipw_geo.c
include/net/inet_sock.h:208:17: warning: do-while statement is not a
compound statement


iwmc3200wifi:

drivers/net/wireless/iwmc3200wifi/cfg80211.c:241:5: warning: symbol
'iwm_cfg80211_get_station' was not declared. Should it be static?
  CC [M]  drivers/net/wireless/iwmc3200wifi/cfg80211.o


libertas:

  CHECK   drivers/net/wireless/libertas/assoc.c
drivers/net/wireless/libertas/assoc.c:48:47: error: bad constant expression

libertas_tf:

  CC [M]  drivers/net/wireless/libertas_tf/main.o
drivers/net/wireless/libertas_tf/main.c: In function ‘lbtf_rx’:
drivers/net/wireless/libertas_tf/main.c:506: warning: ‘stats.antenna’
is used uninitialized in this function
drivers/net/wireless/libertas_tf/main.c:506: warning: ‘stats.mactime’
is used uninitialized in this function

Orinoco:

  CHECK   drivers/net/wireless/orinoco/wext.c
drivers/net/wireless/orinoco/wext.c:1294:9: warning: context imbalance
in 'orinoco_ioctl_setibssport' - unexpected unlock

prism54:

  CHECK   drivers/net/wireless/prism54/isl_ioctl.c
drivers/net/wireless/prism54/isl_ioctl.c:2052:27: warning: incorrect
type in assignment (different address spaces)
drivers/net/wireless/prism54/isl_ioctl.c:2052:27:    expected void
[noderef] <asn:1>*pointer
drivers/net/wireless/prism54/isl_ioctl.c:2052:27:    got char *[assigned] memptr
drivers/net/wireless/prism54/isl_ioctl.c:2071:27: warning: incorrect
type in assignment (different address spaces)
drivers/net/wireless/prism54/isl_ioctl.c:2071:27:    expected void
[noderef] <asn:1>*pointer
drivers/net/wireless/prism54/isl_ioctl.c:2071:27:    got char *[assigned] memptr


drivers/net/wireless/prism54/oid_mgt.c:424:22: warning: symbol '_data'
shadows an earlier one
incude/asm-generic/sections.h:7:13: originally declared here


rtl:

  CHECK   drivers/net/wireless/rtl818x/rtl8180_rtl8225.c
drivers/net/wireless/rtl818x/rtl8180_rtl8225.c:53:33: warning: dubious: x | !y

TI:

  CHECK   drivers/net/wireless/wl12xx/wl1251_boot.c
drivers/net/wireless/wl12xx/wl1251_boot.c:227:22: warning: symbol
'interrupt' shadows an earlier one
/home/mcgrof/wireless-testing/arch/x86/include/asm/hw_irq.h:120:13:
originally declared here

  CHECK   drivers/net/wireless/wl12xx/wl1251_sdio.c
drivers/net/wireless/wl12xx/wl1251_sdio.c:68:6: warning: symbol
'wl1251_sdio_read' was not declared. Should it be static?
drivers/net/wireless/wl12xx/wl1251_sdio.c:80:6: warning: symbol
'wl1251_sdio_write' was not declared. Should it be static?
drivers/net/wireless/wl12xx/wl1251_sdio.c:92:6: warning: symbol
'wl1251_sdio_reset' was not declared. Should it be static?
drivers/net/wireless/wl12xx/wl1251_sdio.c:114:6: warning: symbol
'wl1251_sdio_set_power' was not declared. Should it be static?
drivers/net/wireless/wl12xx/wl1251_sdio.c:118:29: warning: symbol
'wl1251_sdio_ops' was not declared. Should it be static?
drivers/net/wireless/wl12xx/wl1251_sdio.c:126:5: warning: symbol
'wl1251_sdio_probe' was not declared. Should it be static?


strip:

include/net/inet_sock.h:208:17: warning: do-while statement is not a
compound statement
drivers/net/wireless/strip.c:490:23: error: bad constant expression

wl3501_cs:

  CC [M]  drivers/net/wireless/wl3501_cs.o
drivers/net/wireless/wl3501_cs.c: In function ‘wl3501_esbq_exec’:
drivers/net/wireless/wl3501_cs.c:387: warning: ‘tmp’ is used
uninitialized in this function
drivers/net/wireless/wl3501_cs.c:384: note: ‘tmp’ was declared here

mwl8k:

  CHECK   drivers/net/wireless/mwl8k.c
drivers/net/wireless/mwl8k.c:1600:16: warning: incorrect type in
assignment (different address spaces)
drivers/net/wireless/mwl8k.c:1600:16:    expected unsigned short
[noderef] [usertype] <asn:2>*result
drivers/net/wireless/mwl8k.c:1600:16:    got unsigned short *<noident>
drivers/net/wireless/mwl8k.c:1611:23: warning: dereference of noderef expression
drivers/net/wireless/mwl8k.c:1616:33: warning: dereference of noderef expression

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

* Re: Spare warnings - wireless drivers
  2009-08-13 20:31 Spare warnings - wireless drivers Luis R. Rodriguez
@ 2009-08-13 20:51 ` Larry Finger
  2009-08-14  0:34 ` [PATCH] libertas: don't use dynamic-sized array Andrey Yurovsky
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Larry Finger @ 2009-08-13 20:51 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless

Luis R. Rodriguez wrote:
> b43:
> 
>   CHECK   drivers/net/wireless/b43/phy_g.c
> drivers/net/wireless/b43/phy_g.c:974:56: warning: cast truncates bits
> from constant value (ffff7fff becomes 7fff)
> 
> ...
> 
>   CHECK   drivers/net/wireless/b43/wa.c
> drivers/net/wireless/b43/wa.c:385:60: warning: cast truncates bits
> from constant value (ffff00ff becomes ff)
> drivers/net/wireless/b43/wa.c:403:55: warning: cast truncates bits
> from constant value (ffff00ff becomes ff)
> drivers/net/wireless/b43/wa.c:405:55: warning: cast truncates bits
> from constant value (ffff00ff becomes ff)
> drivers/net/wireless/b43/wa.c:415:71: warning: cast truncates bits
> from constant value (ffff0fff becomes fff)

I'm aware of these warnings, and I have fixes for all of them. I'm
waiting for the new LP PHY to get checked in as there are a number in
it as well.

Larry


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

* [PATCH] libertas: don't use dynamic-sized array
  2009-08-13 20:31 Spare warnings - wireless drivers Luis R. Rodriguez
  2009-08-13 20:51 ` Larry Finger
@ 2009-08-14  0:34 ` Andrey Yurovsky
  2009-08-19 17:09   ` Dan Williams
  2009-08-14 17:21 ` Spare warnings - wireless drivers Kalle Valo
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Andrey Yurovsky @ 2009-08-14  0:34 UTC (permalink / raw)
  To: linux-wireless; +Cc: dcbw, Andrey Yurovsky

sparse complains about a bad constant expression due to the use of a
dynamic-sized array in get_common_rates().  Allocate and free the array
instead.

Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>
---
 drivers/net/wireless/libertas/assoc.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 1902b6f..9834399 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -45,9 +45,14 @@ static int get_common_rates(struct lbs_private *priv,
 {
 	u8 *card_rates = lbs_bg_rates;
 	int ret = 0, i, j;
-	u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)];
+	u8 *tmp;
 	size_t tmp_size = 0;
 
+	tmp = kzalloc((ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1),
+			GFP_KERNEL);
+	if (!tmp)
+		return -1;
+
 	/* For each rate in card_rates that exists in rate1, copy to tmp */
 	for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) {
 		for (j = 0; j < *rates_size && rates[j]; j++) {
@@ -75,6 +80,7 @@ done:
 	memset(rates, 0, *rates_size);
 	*rates_size = min_t(int, tmp_size, *rates_size);
 	memcpy(rates, tmp, *rates_size);
+	kfree(tmp);
 	return ret;
 }
 
-- 
1.5.6.3


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

* Re: Spare warnings - wireless drivers
  2009-08-13 20:31 Spare warnings - wireless drivers Luis R. Rodriguez
  2009-08-13 20:51 ` Larry Finger
  2009-08-14  0:34 ` [PATCH] libertas: don't use dynamic-sized array Andrey Yurovsky
@ 2009-08-14 17:21 ` Kalle Valo
  2009-08-14 17:30 ` Dave
  2009-08-14 19:33 ` reinette chatre
  4 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2009-08-14 17:21 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless

"Luis R. Rodriguez" <mcgrof@gmail.com> writes:

> TI:
>
>   CHECK   drivers/net/wireless/wl12xx/wl1251_boot.c
> drivers/net/wireless/wl12xx/wl1251_boot.c:227:22: warning: symbol
> 'interrupt' shadows an earlier one
> /home/mcgrof/wireless-testing/arch/x86/include/asm/hw_irq.h:120:13:
> originally declared here
>
>   CHECK   drivers/net/wireless/wl12xx/wl1251_sdio.c
> drivers/net/wireless/wl12xx/wl1251_sdio.c:68:6: warning: symbol
> 'wl1251_sdio_read' was not declared. Should it be static?
> drivers/net/wireless/wl12xx/wl1251_sdio.c:80:6: warning: symbol
> 'wl1251_sdio_write' was not declared. Should it be static?
> drivers/net/wireless/wl12xx/wl1251_sdio.c:92:6: warning: symbol
> 'wl1251_sdio_reset' was not declared. Should it be static?
> drivers/net/wireless/wl12xx/wl1251_sdio.c:114:6: warning: symbol
> 'wl1251_sdio_set_power' was not declared. Should it be static?
> drivers/net/wireless/wl12xx/wl1251_sdio.c:118:29: warning: symbol
> 'wl1251_sdio_ops' was not declared. Should it be static?
> drivers/net/wireless/wl12xx/wl1251_sdio.c:126:5: warning: symbol
> 'wl1251_sdio_probe' was not declared. Should it be static?

Thanks. I'll fix these.

-- 
Kalle Valo

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

* Re: Spare warnings - wireless drivers
  2009-08-13 20:31 Spare warnings - wireless drivers Luis R. Rodriguez
                   ` (2 preceding siblings ...)
  2009-08-14 17:21 ` Spare warnings - wireless drivers Kalle Valo
@ 2009-08-14 17:30 ` Dave
  2009-08-14 18:10   ` Johannes Berg
  2009-08-14 19:33 ` reinette chatre
  4 siblings, 1 reply; 10+ messages in thread
From: Dave @ 2009-08-14 17:30 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless

Luis R. Rodriguez wrote:
> Orinoco:
> 
>   CHECK   drivers/net/wireless/orinoco/wext.c
> drivers/net/wireless/orinoco/wext.c:1294:9: warning: context imbalance
> in 'orinoco_ioctl_setibssport' - unexpected unlock

Thanks for the heads up.

I've been staring at setibssport for 5 minutes, and can't see the
alleged imbalance. False positive?

I can't see why sparse picked on setibssport either - half the other
functions in that file do exactly the same.


Dave.

---
PS. since it's short, the full function is:

static int orinoco_ioctl_setibssport(struct net_device *dev,
				     struct iw_request_info *info,
				     void *wrqu,
				     char *extra)
{
	struct orinoco_private *priv = ndev_priv(dev);
	int val = *((int *) extra);
	unsigned long flags;

	if (orinoco_lock(priv, &flags) != 0)
		return -EBUSY;

	priv->ibss_port = val ;

	/* Actually update the mode we are using */
	set_port_type(priv);

	orinoco_unlock(priv, &flags);
	return -EINPROGRESS;		/* Call commit handler */
}

... and there's no (un)locking in set_port_type

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

* Re: Spare warnings - wireless drivers
  2009-08-14 17:30 ` Dave
@ 2009-08-14 18:10   ` Johannes Berg
  2009-08-14 18:11     ` Gábor Stefanik
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Berg @ 2009-08-14 18:10 UTC (permalink / raw)
  To: Dave; +Cc: Luis R. Rodriguez, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

On Fri, 2009-08-14 at 18:30 +0100, Dave wrote:

> I've been staring at setibssport for 5 minutes, and can't see the
> alleged imbalance. False positive?
> 
> I can't see why sparse picked on setibssport either - half the other
> functions in that file do exactly the same.

Yeah, I've been there too -- no idea why that particular function trips
up sparse.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: Spare warnings - wireless drivers
  2009-08-14 18:10   ` Johannes Berg
@ 2009-08-14 18:11     ` Gábor Stefanik
  0 siblings, 0 replies; 10+ messages in thread
From: Gábor Stefanik @ 2009-08-14 18:11 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Dave, Luis R. Rodriguez, linux-wireless

On Fri, Aug 14, 2009 at 8:10 PM, Johannes Berg<johannes@sipsolutions.net> wrote:
> On Fri, 2009-08-14 at 18:30 +0100, Dave wrote:
>
>> I've been staring at setibssport for 5 minutes, and can't see the
>> alleged imbalance. False positive?
>>
>> I can't see why sparse picked on setibssport either - half the other
>> functions in that file do exactly the same.
>
> Yeah, I've been there too -- no idea why that particular function trips
> up sparse.
>
> johannes
>

It's literally a sparse warning, then.

-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

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

* Re: Spare warnings - wireless drivers
  2009-08-13 20:31 Spare warnings - wireless drivers Luis R. Rodriguez
                   ` (3 preceding siblings ...)
  2009-08-14 17:30 ` Dave
@ 2009-08-14 19:33 ` reinette chatre
  4 siblings, 0 replies; 10+ messages in thread
From: reinette chatre @ 2009-08-14 19:33 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless

On Thu, 2009-08-13 at 13:31 -0700, Luis R. Rodriguez wrote:

>   CHECK   drivers/net/wireless/ipw2x00/ipw2100.c
> include/net/inet_sock.h:208:17: warning: do-while statement is not a
> compound statement
> drivers/net/wireless/ipw2x00/ipw2100.c:2847:21: warning: symbol 'i'
> shadows an earlier one
> drivers/net/wireless/ipw2x00/ipw2100.c:2770:16: originally declared here
> drivers/net/wireless/ipw2x00/ipw2100.c:7888:22: warning: symbol 'mode'
> shadows an earlier one
> drivers/net/wireless/ipw2x00/ipw2100.c:188:12: originally declared here
> drivers/net/wireless/ipw2x00/ipw2100.c:7952:18: warning: symbol 'mode'
> shadows an earlier one
> drivers/net/wireless/ipw2x00/ipw2100.c:188:12: originally declared here
> drivers/net/wireless/ipw2x00/ipw2100.c:8000:18: warning: symbol 'mode'
> shadows an earlier one

[...]

Thanks Luis.

Does not look like sparse was ever run for ipw2x00 ... the driver
specific ones will be addressed. Seems like other people also ran into
the:

>   CHECK   drivers/net/wireless/ipw2x00/libipw_module.c
> include/net/inet_sock.h:208:17: warning: do-while statement is not a
> compound statement

There is already a patch for this one ([1]) but I cannot tell of the
kmemcheck folks merged it.

Reinette

[1] http://thread.gmane.org/gmane.linux.kernel/861983


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

* Re: [PATCH] libertas: don't use dynamic-sized array
  2009-08-14  0:34 ` [PATCH] libertas: don't use dynamic-sized array Andrey Yurovsky
@ 2009-08-19 17:09   ` Dan Williams
  2009-08-21 13:24     ` Dan Williams
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Williams @ 2009-08-19 17:09 UTC (permalink / raw)
  To: Andrey Yurovsky; +Cc: linux-wireless

On Thu, 2009-08-13 at 17:34 -0700, Andrey Yurovsky wrote:
> sparse complains about a bad constant expression due to the use of a
> dynamic-sized array in get_common_rates().  Allocate and free the array
> instead.

Mind testing this patch from libertas-dev?  It should fix this but also
clears up some of the confustion:

                           Subject: 
Re: Libertas: Association request to
the driver failed
                              Date: 
Wed, 12 Aug 2009 12:34:17 -0500

Signed-off-by: Dan Williams <dcbw@redhat.com>


diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 1902b6f..8c05388 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -35,7 +35,8 @@ static const u8 bssid_off[ETH_ALEN]  __attribute__ ((aligned (2))) =
  *
  *  @param priv     A pointer to struct lbs_private structure
  *  @param rates       the buffer which keeps input and output
- *  @param rates_size  the size of rate1 buffer; new size of buffer on return
+ *  @param rates_size  the size of rates buffer; new size of buffer on return,
+ *                     which will be less than or equal to original rates_size
  *
  *  @return            0 on success, or -1 on error
  */
@@ -43,39 +44,42 @@ static int get_common_rates(struct lbs_private *priv,
        u8 *rates,
        u16 *rates_size)
 {
-       u8 *card_rates = lbs_bg_rates;
-       int ret = 0, i, j;
-       u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)];
-       size_t tmp_size = 0;
-
-       /* For each rate in card_rates that exists in rate1, copy to tmp */
-       for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) {
-               for (j = 0; j < *rates_size && rates[j]; j++) {
-                       if (rates[j] == card_rates[i])
-                               tmp[tmp_size++] = card_rates[i];
+       int i, j;
+       u8 intersection[MAX_RATES];
+       u16 intersection_size;
+       u16 num_rates = 0;
+
+       intersection_size = min_t(u16, *rates_size, ARRAY_SIZE(intersection));
+
+       /* Allow each rate from 'rates' that is supported by the hardware */
+       for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && lbs_bg_rates[i]; i++) {
+               for (j = 0; j < intersection_size && rates[j]; j++) {
+                       if (rates[j] == lbs_bg_rates[i])
+                               intersection[num_rates++] = rates[j];
                }
        }
 
        lbs_deb_hex(LBS_DEB_JOIN, "AP rates    ", rates, *rates_size);
-       lbs_deb_hex(LBS_DEB_JOIN, "card rates  ", card_rates,
+       lbs_deb_hex(LBS_DEB_JOIN, "card rates  ", lbs_bg_rates,
                        ARRAY_SIZE(lbs_bg_rates));
-       lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size);
+       lbs_deb_hex(LBS_DEB_JOIN, "common rates", intersection, num_rates);
        lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate);
 
        if (!priv->enablehwauto) {
-               for (i = 0; i < tmp_size; i++) {
-                       if (tmp[i] == priv->cur_rate)
+               for (i = 0; i < num_rates; i++) {
+                       if (intersection[i] == priv->cur_rate)
                                goto done;
                }
                lbs_pr_alert("Previously set fixed data rate %#x isn't "
                       "compatible with the network.\n", priv->cur_rate);
-               ret = -1;
+               return -1;
        }
+
 done:
        memset(rates, 0, *rates_size);
-       *rates_size = min_t(int, tmp_size, *rates_size);
-       memcpy(rates, tmp, *rates_size);
-       return ret;
+       *rates_size = num_rates;
+       memcpy(rates, intersection, num_rates);
+       return 0;
 }
 
 
@@ -317,8 +321,8 @@ static int lbs_associate(struct lbs_private *priv,
 
        rates = (struct mrvl_ie_rates_param_set *) pos;
        rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
-       memcpy(&rates->rates, &bss->rates, MAX_RATES);
-       tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES);
+       tmplen = min_t(u16, ARRAY_SIZE(bss->rates), MAX_RATES);
+       memcpy(&rates->rates, &bss->rates, tmplen);
        if (get_common_rates(priv, rates->rates, &tmplen)) {
                ret = -1;
                goto done;
@@ -592,7 +596,7 @@ static int lbs_adhoc_join(struct lbs_private *priv,
 
        /* Copy Data rates from the rates recorded in scan response */
        memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates));
-       ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES);
+       ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), ARRAY_SIZE (bss->rates));
        memcpy(cmd.bss.rates, bss->rates, ratesize);
        if (get_common_rates(priv, cmd.bss.rates, &ratesize)) {
                lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n");


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

* Re: [PATCH] libertas: don't use dynamic-sized array
  2009-08-19 17:09   ` Dan Williams
@ 2009-08-21 13:24     ` Dan Williams
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Williams @ 2009-08-21 13:24 UTC (permalink / raw)
  To: Andrey Yurovsky; +Cc: linux-wireless

On Wed, 2009-08-19 at 12:09 -0500, Dan Williams wrote:
> On Thu, 2009-08-13 at 17:34 -0700, Andrey Yurovsky wrote:
> > sparse complains about a bad constant expression due to the use of a
> > dynamic-sized array in get_common_rates().  Allocate and free the array
> > instead.
> 
> Mind testing this patch from libertas-dev?  It should fix this but also
> clears up some of the confustion:

FWIW this patch now tested with sd8686.

Dan

>                            Subject: 
> Re: Libertas: Association request to
> the driver failed
>                               Date: 
> Wed, 12 Aug 2009 12:34:17 -0500
> 
> Signed-off-by: Dan Williams <dcbw@redhat.com>
> 
> 
> diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
> index 1902b6f..8c05388 100644
> --- a/drivers/net/wireless/libertas/assoc.c
> +++ b/drivers/net/wireless/libertas/assoc.c
> @@ -35,7 +35,8 @@ static const u8 bssid_off[ETH_ALEN]  __attribute__ ((aligned (2))) =
>   *
>   *  @param priv     A pointer to struct lbs_private structure
>   *  @param rates       the buffer which keeps input and output
> - *  @param rates_size  the size of rate1 buffer; new size of buffer on return
> + *  @param rates_size  the size of rates buffer; new size of buffer on return,
> + *                     which will be less than or equal to original rates_size
>   *
>   *  @return            0 on success, or -1 on error
>   */
> @@ -43,39 +44,42 @@ static int get_common_rates(struct lbs_private *priv,
>         u8 *rates,
>         u16 *rates_size)
>  {
> -       u8 *card_rates = lbs_bg_rates;
> -       int ret = 0, i, j;
> -       u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)];
> -       size_t tmp_size = 0;
> -
> -       /* For each rate in card_rates that exists in rate1, copy to tmp */
> -       for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) {
> -               for (j = 0; j < *rates_size && rates[j]; j++) {
> -                       if (rates[j] == card_rates[i])
> -                               tmp[tmp_size++] = card_rates[i];
> +       int i, j;
> +       u8 intersection[MAX_RATES];
> +       u16 intersection_size;
> +       u16 num_rates = 0;
> +
> +       intersection_size = min_t(u16, *rates_size, ARRAY_SIZE(intersection));
> +
> +       /* Allow each rate from 'rates' that is supported by the hardware */
> +       for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && lbs_bg_rates[i]; i++) {
> +               for (j = 0; j < intersection_size && rates[j]; j++) {
> +                       if (rates[j] == lbs_bg_rates[i])
> +                               intersection[num_rates++] = rates[j];
>                 }
>         }
>  
>         lbs_deb_hex(LBS_DEB_JOIN, "AP rates    ", rates, *rates_size);
> -       lbs_deb_hex(LBS_DEB_JOIN, "card rates  ", card_rates,
> +       lbs_deb_hex(LBS_DEB_JOIN, "card rates  ", lbs_bg_rates,
>                         ARRAY_SIZE(lbs_bg_rates));
> -       lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size);
> +       lbs_deb_hex(LBS_DEB_JOIN, "common rates", intersection, num_rates);
>         lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate);
>  
>         if (!priv->enablehwauto) {
> -               for (i = 0; i < tmp_size; i++) {
> -                       if (tmp[i] == priv->cur_rate)
> +               for (i = 0; i < num_rates; i++) {
> +                       if (intersection[i] == priv->cur_rate)
>                                 goto done;
>                 }
>                 lbs_pr_alert("Previously set fixed data rate %#x isn't "
>                        "compatible with the network.\n", priv->cur_rate);
> -               ret = -1;
> +               return -1;
>         }
> +
>  done:
>         memset(rates, 0, *rates_size);
> -       *rates_size = min_t(int, tmp_size, *rates_size);
> -       memcpy(rates, tmp, *rates_size);
> -       return ret;
> +       *rates_size = num_rates;
> +       memcpy(rates, intersection, num_rates);
> +       return 0;
>  }
>  
> 
> @@ -317,8 +321,8 @@ static int lbs_associate(struct lbs_private *priv,
>  
>         rates = (struct mrvl_ie_rates_param_set *) pos;
>         rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
> -       memcpy(&rates->rates, &bss->rates, MAX_RATES);
> -       tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES);
> +       tmplen = min_t(u16, ARRAY_SIZE(bss->rates), MAX_RATES);
> +       memcpy(&rates->rates, &bss->rates, tmplen);
>         if (get_common_rates(priv, rates->rates, &tmplen)) {
>                 ret = -1;
>                 goto done;
> @@ -592,7 +596,7 @@ static int lbs_adhoc_join(struct lbs_private *priv,
>  
>         /* Copy Data rates from the rates recorded in scan response */
>         memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates));
> -       ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES);
> +       ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), ARRAY_SIZE (bss->rates));
>         memcpy(cmd.bss.rates, bss->rates, ratesize);
>         if (get_common_rates(priv, cmd.bss.rates, &ratesize)) {
>                 lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n");
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

end of thread, other threads:[~2009-08-21 13:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-13 20:31 Spare warnings - wireless drivers Luis R. Rodriguez
2009-08-13 20:51 ` Larry Finger
2009-08-14  0:34 ` [PATCH] libertas: don't use dynamic-sized array Andrey Yurovsky
2009-08-19 17:09   ` Dan Williams
2009-08-21 13:24     ` Dan Williams
2009-08-14 17:21 ` Spare warnings - wireless drivers Kalle Valo
2009-08-14 17:30 ` Dave
2009-08-14 18:10   ` Johannes Berg
2009-08-14 18:11     ` Gábor Stefanik
2009-08-14 19:33 ` reinette chatre

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