Linux wireless drivers development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Bing Zhao <bzhao@marvell.com>
Cc: Yogesh Powar <yogeshp@marvell.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: mwifiex: add cfg80211 handlers add/del_virtual_intf
Date: Wed, 5 Oct 2011 22:52:28 +0300	[thread overview]
Message-ID: <20111005195228.GG30887@longonot.mountain> (raw)
In-Reply-To: <477F20668A386D41ADCC57781B1F70430815597445@SC-VEXCH1.marvell.com>

On Wed, Oct 05, 2011 at 12:08:36PM -0700, Bing Zhao wrote:
> 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);
> 

I don't know the code at all, so I'll trust you on that.  :)

But please don't add the BUG_ON().  Calls to BUG_ON() make the code
messier, and they are more painful than needed for the user.  If we
don't have the BUG_ON() then we get an Oops and the driver will die,
but we can still can close our documents and reboot the system.

Debugging NULL dereference bugs is normally super easy.  Just compile
with CONFIG_DEBUG_INFO=y, run gdb on the .ko file and type:
"list *(function_name+0x63)" at the gdb prompt.  Done.

regards,
dan carpenter


  reply	other threads:[~2011-10-05 19:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=20111005195228.GG30887@longonot.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