Commit 1bcca3c463e4930cef9986b05165bb0b3eb46f63
Committed by
John W. Linville
1 parent
15ea0ebc5b
Exists in
master
and in
4 other branches
hostap: fix sparse warnings
Rewrite AID calculation in handle_pspoll() to avoid truncating bits. Make hostap_80211_header_parse() static, don't export it. Avoid shadowing variables. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Showing 5 changed files with 15 additions and 16 deletions Side-by-side Diff
drivers/net/wireless/hostap/hostap_80211_rx.c
... | ... | @@ -64,7 +64,7 @@ |
64 | 64 | int hdrlen, phdrlen, head_need, tail_need; |
65 | 65 | u16 fc; |
66 | 66 | int prism_header, ret; |
67 | - struct ieee80211_hdr_4addr *hdr; | |
67 | + struct ieee80211_hdr_4addr *fhdr; | |
68 | 68 | |
69 | 69 | iface = netdev_priv(dev); |
70 | 70 | local = iface->local; |
... | ... | @@ -83,8 +83,8 @@ |
83 | 83 | phdrlen = 0; |
84 | 84 | } |
85 | 85 | |
86 | - hdr = (struct ieee80211_hdr_4addr *) skb->data; | |
87 | - fc = le16_to_cpu(hdr->frame_ctl); | |
86 | + fhdr = (struct ieee80211_hdr_4addr *) skb->data; | |
87 | + fc = le16_to_cpu(fhdr->frame_ctl); | |
88 | 88 | |
89 | 89 | if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { |
90 | 90 | printk(KERN_DEBUG "%s: dropped management frame with header " |
drivers/net/wireless/hostap/hostap_ap.c
... | ... | @@ -1930,7 +1930,7 @@ |
1930 | 1930 | PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n"); |
1931 | 1931 | return; |
1932 | 1932 | } |
1933 | - aid &= ~BIT(15) & ~BIT(14); | |
1933 | + aid &= ~(BIT(15) | BIT(14)); | |
1934 | 1934 | if (aid == 0 || aid > MAX_AID_TABLE_SIZE) { |
1935 | 1935 | PDEBUG(DEBUG_PS, " invalid aid=%d\n", aid); |
1936 | 1936 | return; |
drivers/net/wireless/hostap/hostap_cs.c
... | ... | @@ -533,10 +533,10 @@ |
533 | 533 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
534 | 534 | |
535 | 535 | #define CFG_CHECK2(fn, retf) \ |
536 | -do { int ret = (retf); \ | |
537 | -if (ret != 0) { \ | |
538 | - PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \ | |
539 | - cs_error(link, fn, ret); \ | |
536 | +do { int _ret = (retf); \ | |
537 | +if (_ret != 0) { \ | |
538 | + PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", _ret); \ | |
539 | + cs_error(link, fn, _ret); \ | |
540 | 540 | goto next_entry; \ |
541 | 541 | } \ |
542 | 542 | } while (0) |
drivers/net/wireless/hostap/hostap_hw.c
... | ... | @@ -2835,7 +2835,7 @@ |
2835 | 2835 | { |
2836 | 2836 | local_info_t *local = (local_info_t *) data; |
2837 | 2837 | struct net_device *dev = local->dev; |
2838 | - u16 channel; | |
2838 | + u16 chan; | |
2839 | 2839 | |
2840 | 2840 | if (local->passive_scan_interval <= 0) |
2841 | 2841 | return; |
2842 | 2842 | |
... | ... | @@ -2872,11 +2872,11 @@ |
2872 | 2872 | |
2873 | 2873 | printk(KERN_DEBUG "%s: passive scan channel %d\n", |
2874 | 2874 | dev->name, local->passive_scan_channel); |
2875 | - channel = local->passive_scan_channel; | |
2875 | + chan = local->passive_scan_channel; | |
2876 | 2876 | local->passive_scan_state = PASSIVE_SCAN_WAIT; |
2877 | 2877 | local->passive_scan_timer.expires = jiffies + HZ / 10; |
2878 | 2878 | } else { |
2879 | - channel = local->channel; | |
2879 | + chan = local->channel; | |
2880 | 2880 | local->passive_scan_state = PASSIVE_SCAN_LISTEN; |
2881 | 2881 | local->passive_scan_timer.expires = jiffies + |
2882 | 2882 | local->passive_scan_interval * HZ; |
2883 | 2883 | |
... | ... | @@ -2884,9 +2884,9 @@ |
2884 | 2884 | |
2885 | 2885 | if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_TEST | |
2886 | 2886 | (HFA384X_TEST_CHANGE_CHANNEL << 8), |
2887 | - channel, NULL, 0)) | |
2887 | + chan, NULL, 0)) | |
2888 | 2888 | printk(KERN_ERR "%s: passive scan channel set %d " |
2889 | - "failed\n", dev->name, channel); | |
2889 | + "failed\n", dev->name, chan); | |
2890 | 2890 | |
2891 | 2891 | add_timer(&local->passive_scan_timer); |
2892 | 2892 | } |
drivers/net/wireless/hostap/hostap_main.c
... | ... | @@ -594,7 +594,8 @@ |
594 | 594 | } |
595 | 595 | |
596 | 596 | |
597 | -int hostap_80211_header_parse(const struct sk_buff *skb, unsigned char *haddr) | |
597 | +static int hostap_80211_header_parse(const struct sk_buff *skb, | |
598 | + unsigned char *haddr) | |
598 | 599 | { |
599 | 600 | struct hostap_interface *iface = netdev_priv(skb->dev); |
600 | 601 | local_info_t *local = iface->local; |
... | ... | @@ -857,7 +858,6 @@ |
857 | 858 | .rebuild = eth_rebuild_header, |
858 | 859 | .cache = eth_header_cache, |
859 | 860 | .cache_update = eth_header_cache_update, |
860 | - | |
861 | 861 | .parse = hostap_80211_header_parse, |
862 | 862 | }; |
863 | 863 | EXPORT_SYMBOL(hostap_80211_ops); |
... | ... | @@ -1150,7 +1150,6 @@ |
1150 | 1150 | EXPORT_SYMBOL(hostap_set_auth_algs); |
1151 | 1151 | EXPORT_SYMBOL(hostap_dump_rx_header); |
1152 | 1152 | EXPORT_SYMBOL(hostap_dump_tx_header); |
1153 | -EXPORT_SYMBOL(hostap_80211_header_parse); | |
1154 | 1153 | EXPORT_SYMBOL(hostap_80211_get_hdrlen); |
1155 | 1154 | EXPORT_SYMBOL(hostap_get_stats); |
1156 | 1155 | EXPORT_SYMBOL(hostap_setup_dev); |