2007-08-15 10:41:54

by Johannes Berg

[permalink] [raw]
Subject: warnings in iwlwifi

CC [M] drivers/net/wireless/iwl-base-3945.o
drivers/net/wireless/iwl-base.c: In function ‘iwl_handle_data_packet_monitor’:
drivers/net/wireless/iwl-base.c:3318: warning: integer overflow in expression
drivers/net/wireless/iwl-base.c:3318: warning: integer overflow in expression
CC [M] drivers/net/wireless/iwl-3945.o
CC [M] drivers/net/wireless/iwl-3945-rs.o
CC [M] drivers/net/wireless/iwl-base-4965.o
drivers/net/wireless/iwl-base.c:2169: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c:2170: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c:2171: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c:2172: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c:2173: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c:2179: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c:2181: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c:2183: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c:2185: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c:2186: warning: large integer implicitly truncated to unsigned type
drivers/net/wireless/iwl-base.c: In function ‘iwl_handle_data_packet_monitor’:
drivers/net/wireless/iwl-base.c:3318: warning: integer overflow in expression
drivers/net/wireless/iwl-base.c:3318: warning: integer overflow in expression


I suspect most of them are caused by endianness bugs.
This for example:

le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;

looks totally bogus unless you somehow do macro magic to define the
RX_RES_PHY...MASK in little endian...

Maybe it's time for you to get a cross compiler or better yet buy a
big-endian machine and actually test things on that? :)

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-08-15 13:36:58

by Johannes Berg

[permalink] [raw]
Subject: Re: warnings in iwlwifi

On Wed, 2007-08-15 at 16:27 +0300, Tomas Winkler wrote:

> I cannot get this error in my environment can you describe yours?

Weird, I'll go ignore the errors for now. Stock debian unstable install
with gcc 4.2.1-1 on 32-bit powerpc. Need to anything else?

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-08-15 15:09:27

by Ian Schram

[permalink] [raw]
Subject: Re: warnings in iwlwifi



Johannes Berg wrote:
> CC [M] drivers/net/wireless/iwl-base-3945.o
> drivers/net/wireless/iwl-base.c: In function =E2=80=98iwl_handle_data=
_packet_monitor=E2=80=99:
> drivers/net/wireless/iwl-base.c:3318: warning: integer overflow in ex=
pression
> drivers/net/wireless/iwl-base.c:3318: warning: integer overflow in ex=
pression
> CC [M] drivers/net/wireless/iwl-3945.o
> CC [M] drivers/net/wireless/iwl-3945-rs.o
> CC [M] drivers/net/wireless/iwl-base-4965.o
> drivers/net/wireless/iwl-base.c:2169: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c:2170: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c:2171: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c:2172: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c:2173: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c:2179: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c:2181: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c:2183: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c:2185: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c:2186: warning: large integer implicit=
ly truncated to unsigned type
> drivers/net/wireless/iwl-base.c: In function =E2=80=98iwl_handle_data=
_packet_monitor=E2=80=99:
> drivers/net/wireless/iwl-base.c:3318: warning: integer overflow in ex=
pression
> drivers/net/wireless/iwl-base.c:3318: warning: integer overflow in ex=
pression
>=20
>=20
> I suspect most of them are caused by endianness bugs.
> This for example:
>=20
> le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
>=20
> looks totally bogus unless you somehow do macro magic to define the
> RX_RES_PHY...MASK in little endian...

iwl-hw.h:#define RX_RES_PHY_FLAGS_ANTENNA_MSK __const=
ant_cpu_to_le16(0xf0)


I don't understand how this would generate the warning though

>=20
> Maybe it's time for you to get a cross compiler or better yet buy a
> big-endian machine and actually test things on that? :)
>=20

No need for these drastic comments, for two warnings imho ;-)
We all know that one typo can make gcc very upset.
And actually i believe somebody has a big endian anyways. Zhu Yi anounc=
ed that once
and judging from the git commits i'm guessing it's Tomas Winkler.

one of the warnings was already fixed in iwlwifi git yesterday
http://intellinuxwireless.org/repos/?p=3Diwlwifi.git;a=3Dcommit;h=3Db7c=
e8c9f73b44a2f91424ce522844bb29e23a739
which will take care of the 2xxx warnings.

I'm predicting that patch will arrive on linux-wireless soon too.
(took me quite some time to figure this out, because I was looking at t=
he iwlwifi git)



Ian

2007-08-15 11:59:47

by Johannes Berg

[permalink] [raw]
Subject: Re: warnings in iwlwifi

On Wed, 2007-08-15 at 13:54 +0200, ian wrote:

> > le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
> >
> > looks totally bogus unless you somehow do macro magic to define the
> > RX_RES_PHY...MASK in little endian...
>
> iwl-hw.h:#define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)

> I don't understand how this would generate the warning though

Ah, so there is macro magic. Why that, and not just convert the value to
CPU first and then mask? i.e.
#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xF0
and use
(le16_to_cpu(phy_flags_hw) & RX_RES...MSK) >> 4
or something?

> > Maybe it's time for you to get a cross compiler or better yet buy a
> > big-endian machine and actually test things on that? :)
> >
>
> No need for these drastic comments, for two warnings imho ;-)

:)

I'm spammed by warnings right now in my kernel build for some reason.
I'm guessing gcc got a bit more trigger-happy or something.

> I'm predicting that patch will arrive on linux-wireless soon too.
> (took me quite some time to figure this out, because I was looking at the iwlwifi git)

Alright :)

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-08-15 13:27:54

by Tomas Winkler

[permalink] [raw]
Subject: Re: warnings in iwlwifi

On 8/15/07, Johannes Berg <[email protected]> wrote:
> On Wed, 2007-08-15 at 13:54 +0200, ian wrote:
>
> > > le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
> > >
> > > looks totally bogus unless you somehow do macro magic to define the
> > > RX_RES_PHY...MASK in little endian...
> >
> > iwl-hw.h:#define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)
>
> > I don't understand how this would generate the warning though
>
> Ah, so there is macro magic. Why that, and not just convert the value to
> CPU first and then mask? i.e.
> #define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xF0
> and use
> (le16_to_cpu(phy_flags_hw) & RX_RES...MSK) >> 4
> or something?
>
> > > Maybe it's time for you to get a cross compiler or better yet buy a
> > > big-endian machine and actually test things on that? :)
> > >
> >
> > No need for these drastic comments, for two warnings imho ;-)
>
> :)
>
> I'm spammed by warnings right now in my kernel build for some reason.
> I'm guessing gcc got a bit more trigger-happy or something.
>
> > I'm predicting that patch will arrive on linux-wireless soon too.
> > (took me quite some time to figure this out, because I was looking at the iwlwifi git)
>
> Alright :)
>

I cannot get this error in my environment can you describe yours?
Thanks for your input
Tomas

> johannes
>
>