Hi Dan, Thanks for your comment. > -----Original Message----- > From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx] > Sent: Tuesday, October 04, 2011 11:08 PM > To: Yogesh Powar > Cc: Bing Zhao; linux-wireless@xxxxxxxxxxxxxxx > Subject: re: mwifiex: add cfg80211 handlers add/del_virtual_intf > > 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? That's a good catch. Since the first element of priv[] cannot be NULL. How about this fix? + priv = adapter->priv[0]; + BUG_ON(!priv); + wiphy_unregister(priv->wdev->wiphy); Thanks, Bing > > regards, > dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html