Skip to contentSkip to conversation

staging/wlan-ng: Fix 'Branch condition evaluates to a garbage value' in p80211netdev.c

PATCH New Peter Huewe 1 participant 1 message Feb 14, 2013 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging/wlan-ng: Fix 'Branch condition evaluates to a garbage value' in p80211netdev.c

clang/scan-build complains that:
p80211netdev.c:451:6: warning: Branch condition evaluates to a garbage value

        if ((p80211_wep.data) && (p80211_wep.data != skb->data))
	            ^~~~~~~~~~~~~~~~~

This can happen in p80211knetdev_hard_start_xmit if
- if (wlandev->state != WLAN_DEVICE_OPEN) evaluates to true. the execution flow then continues at the 'failed' label where p80211_wep.data is used without being initialized first.

-> Initialize the data field to NULL to fix this issue.

---
 drivers/staging/wlan-ng/p80211netdev.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/wlan-ng/p80211netdev.c +2 -0
index 750330f..0039e08 100644
@@ -351,6 +351,8 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
 	union p80211_hdr p80211_hdr;
 	struct p80211_metawep p80211_wep;
 
+	p80211_wep.data = NULL;
+
 	if (skb == NULL)
 		return NETDEV_TX_OK;
 
Signature · 1 line
1.7.8.6