Skip to contentSkip to conversation

brcmfmac: Using zero instead of NULL

PATCH In review Dan Carpenter 2 participants 3 messages Oct 3, 2012 – Oct 4, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 brcmfmac: Using zero instead of NULL

Sparse complains that we use zero instead of NULL here. In fact, the initialization is wrong and should be removed. Doing these kinds of bogus initializations means that GCC can't detect unitialized variables and leads to bugs.

drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +1 -1
index ed83b54..9ddafc2 100644
@@ -3973,7 +3973,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg,
 	u8  *curr_ie_buf;
 	u8  *mgmt_ie_buf = NULL;
 	int mgmt_ie_buf_len;
-	u32 *mgmt_ie_len = 0;
+	u32 *mgmt_ie_len;
 	u32 del_add_ie_buf_len = 0;
 	u32 total_ie_buf_len = 0;
 	u32 parsed_ie_buf_len = 0;
#1 lore raw
Quoted 4 lines · Dan Carpenter

Sparse complains that we use zero instead of NULL here. In fact, the initialization is wrong and should be removed. Doing these kinds of bogus initializations means that GCC can't detect unitialized variables and leads to bugs.

We already had it fixed internally, but your change is more sensible. I had it reviewed internally and plan to send it to John for 3.8 (ie. wireless-next after merge window). Let me know if that is ok with you.

Gr. AvS

#2 lore raw
Quoted 10 lines · Arend van Spriel
Quoted 4 lines · Dan Carpenter

Sparse complains that we use zero instead of NULL here. In fact, the initialization is wrong and should be removed. Doing these kinds of bogus initializations means that GCC can't detect unitialized variables and leads to bugs.

We already had it fixed internally, but your change is more sensible. I had it reviewed internally and plan to send it to John for 3.8 (ie. wireless-next after merge window). Let me know if that is ok with you.

Sounds good.

regards,
dan carpenter