From: Dan Carpenter <dan.carpenter@oracle.com>
To: Yogesh Ashok Powar <yogeshp@marvell.com>
Cc: Bing Zhao <bzhao@marvell.com>, linux-wireless@vger.kernel.org
Subject: re: mwifiex: add cfg80211 handlers add/del_virtual_intf
Date: Wed, 5 Oct 2011 09:07:44 +0300 [thread overview]
Message-ID: <20111005060744.GB32513@elgon.mountain> (raw)
Hi Yogesh,
The Smatch static checker complains that 93a1df48d22429 "mwifiex: add
cfg80211 handlers add/del_virtual_intf" introduces a potential NULL
dereference.
@@ -985,9 +817,20 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
atomic_read(&adapter->cmd_pending));
}
- /* Remove interface */
- for (i = 0; i < adapter->priv_num; i++)
- mwifiex_remove_interface(adapter, i);
+ for (i = 0; i < adapter->priv_num; i++) {
+ priv = adapter->priv[i];
+
+ if (!priv)
+ continue;
+
+ rtnl_lock();
+ mwifiex_del_virtual_intf(priv->wdev->wiphy, priv->netdev);
+ rtnl_unlock();
+ }
+
+ wiphy_unregister(priv->wdev->wiphy);
^^^^^^^^^^
Can priv be NULL here? How do we know that the last element of
adapter->priv[]; is non-NULL when we have to check the others?
regards,
dan carpenter
next reply other threads:[~2011-10-05 6:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-05 6:07 Dan Carpenter [this message]
2011-10-05 19:08 ` mwifiex: add cfg80211 handlers add/del_virtual_intf Bing Zhao
2011-10-05 19:52 ` Dan Carpenter
2011-10-05 23:14 ` Bing Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111005060744.GB32513@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=bzhao@marvell.com \
--cc=linux-wireless@vger.kernel.org \
--cc=yogeshp@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox