diff mbox

mac80211_hwsim: missing NULL check

Message ID 1448867812-11089-1-git-send-email-rahul.jain@samsung.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show

Commit Message

Rahul Jain Nov. 30, 2015, 7:16 a.m. UTC
From: Amit Khatri <amit.khatri@samsung.com>

txrate variable might be NULL and passing inside function
without NULL check.

Signed-off-by: Amit Khatri <amit.khatri@samsung.com>
Signed-off-by: Rahul Jain <rahul.jain@samsung.com>
---
 drivers/net/wireless/mac80211_hwsim.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Johannes Berg Dec. 2, 2015, 9:51 a.m. UTC | #1
On Mon, 2015-11-30 at 12:46 +0530, Rahul Jain wrote:
> From: Amit Khatri <amit.khatri@samsung.com>
> 
> txrate variable might be NULL and passing inside function
> without NULL check.

Applied. However, this comes with a big BUT.

I seems to always be rewriting your static checker patches, or asking
for clarification, rewording, etc.

Please: review what I did to this commit, and in the future please
submit patches that actually describe what's going on, what you're
doing, and why you're doing it.

IOW, analyse the code and don't just do the minimum necessary to shut
up the static checker. Doing that is fairly much useless, especially in
really obscure cases like this.

I'm going to drop further patches like this one without warning.

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 194264c..72e4931 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -814,6 +814,9 @@  static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb);
 	struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info);
 
+	if (!txrate)
+		return;
+
 	if (!netif_running(hwsim_mon))
 		return;