Linux wireless drivers development
 help / color / mirror / Atom feed
* re: mwifiex: add cfg80211 handlers add/del_virtual_intf
@ 2011-10-05  6:07 Dan Carpenter
  2011-10-05 19:08 ` Bing Zhao
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-10-05  6:07 UTC (permalink / raw)
  To: Yogesh Ashok Powar; +Cc: Bing Zhao, linux-wireless

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-05 23:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-05  6:07 mwifiex: add cfg80211 handlers add/del_virtual_intf Dan Carpenter
2011-10-05 19:08 ` Bing Zhao
2011-10-05 19:52   ` Dan Carpenter
2011-10-05 23:14     ` Bing Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox