Skip to content

Commit

Permalink
net: mac802154: comparision issue of type cast, finding by EXTRA_CFLA…
Browse files Browse the repository at this point in the history
…GS=-W

Change MAC802154_CHAN_NONE from ~(u8)0 to 0xff, or the comparison in
mac802154_wpan_xmit() for ``chan == MAC802154_CHAN_NONE'' will not
succeed.

This bug can be boiled down to ``u8 foo = 0xff; if (foo == ~(u8)0)
[...] else [...]'' where the condition will always take the else
branch.

Signed-off-by: Chen Gang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Chen Gang authored and davem330 committed Apr 29, 2013
1 parent f7a1dd6 commit 2c1bbbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/mac802154/mac802154.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct mac802154_sub_if_data {

#define MAC802154_MAX_XMIT_ATTEMPTS 3

#define MAC802154_CHAN_NONE (~(u8)0) /* No channel is assigned */
#define MAC802154_CHAN_NONE 0xff /* No channel is assigned */

extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
Expand Down

0 comments on commit 2c1bbbf

Please sign in to comment.