All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: balbi@ti.com
Cc: Evgeny Kuznetsov <EXT-Eugeny.Kuznetsov@nokia.com>,
	"tony@atomide.com" <tony@atomide.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"zmc@lurian.net" <zmc@lurian.net>,
	"a.j.buxton@gmail.com" <a.j.buxton@gmail.com>
Subject: Re: [PATCH 1/1] omap: Ptr "isr_reg" tracked as NULL was dereferenced
Date: Tue, 05 Oct 2010 08:01:12 -0700	[thread overview]
Message-ID: <877hhwvg3r.fsf@deeprootsystems.com> (raw)
In-Reply-To: <20101005093206.GB2977@legolas.emea.dhcp.ti.com> (Felipe Balbi's message of "Tue, 5 Oct 2010 12:32:06 +0300")

Felipe Balbi <balbi@ti.com> writes:

> Hi,
>
> On Tue, Oct 05, 2010 at 03:42:10AM -0500, Evgeny Kuznetsov wrote:
>>+	if (!isr_reg) {
>>+		printk(KERN_ERR "FATAL: Incorrect GPIO method %i\n",
>>+				bank->method);
>>+		BUG();
>>+		}
>
> this could be simply:
>
> BUG_ON(!isr_reg);

WARN_ON is better.

A BUG() will panic the kernel and stop everything.  This is not an error
condition that should prevent the entire kernel from running.

>From asm-generic/bug.h:

/*
 * Don't use BUG() or BUG_ON() unless there's really no way out; one
 * example might be detecting data structure corruption in the middle
 * of an operation that can't be backed out of.  If the (sub)system
 * can somehow continue operating, perhaps with reduced functionality,
 * it's probably not BUG-worthy.
 *
 * If you're tempted to BUG(), think again:  is completely giving up
 * really the *only* solution?  There are usually better options, where
 * users don't need to reboot ASAP and can mostly shut down cleanly.
 */

WARNING: multiple messages have this Message-ID (diff)
From: Kevin Hilman <khilman@deeprootsystems.com>
To: balbi@ti.com
Cc: Evgeny Kuznetsov <EXT-Eugeny.Kuznetsov@nokia.com>,
	"tony\@atomide.com" <tony@atomide.com>,
	"linux-omap\@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"akpm\@linux-foundation.org" <akpm@linux-foundation.org>,
	"zmc\@lurian.net" <zmc@lurian.net>,
	"a.j.buxton\@gmail.com" <a.j.buxton@gmail.com>
Subject: Re: [PATCH 1/1] omap: Ptr "isr_reg" tracked as NULL was dereferenced
Date: Tue, 05 Oct 2010 08:01:12 -0700	[thread overview]
Message-ID: <877hhwvg3r.fsf@deeprootsystems.com> (raw)
In-Reply-To: <20101005093206.GB2977@legolas.emea.dhcp.ti.com> (Felipe Balbi's message of "Tue, 5 Oct 2010 12:32:06 +0300")

Felipe Balbi <balbi@ti.com> writes:

> Hi,
>
> On Tue, Oct 05, 2010 at 03:42:10AM -0500, Evgeny Kuznetsov wrote:
>>+	if (!isr_reg) {
>>+		printk(KERN_ERR "FATAL: Incorrect GPIO method %i\n",
>>+				bank->method);
>>+		BUG();
>>+		}
>
> this could be simply:
>
> BUG_ON(!isr_reg);

WARN_ON is better.

A BUG() will panic the kernel and stop everything.  This is not an error
condition that should prevent the entire kernel from running.

>From asm-generic/bug.h:

/*
 * Don't use BUG() or BUG_ON() unless there's really no way out; one
 * example might be detecting data structure corruption in the middle
 * of an operation that can't be backed out of.  If the (sub)system
 * can somehow continue operating, perhaps with reduced functionality,
 * it's probably not BUG-worthy.
 *
 * If you're tempted to BUG(), think again:  is completely giving up
 * really the *only* solution?  There are usually better options, where
 * users don't need to reboot ASAP and can mostly shut down cleanly.
 */

  parent reply	other threads:[~2010-10-05 15:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05  8:42 [PATCH 0/1] omap: Ptr "isr_reg" tracked as NULL was dereferenced Evgeny Kuznetsov
2010-10-05  8:42 ` [PATCH 1/1] " Evgeny Kuznetsov
2010-10-05  9:32   ` Felipe Balbi
2010-10-05  9:55     ` Evgeny Kuznetsov
2010-10-05 11:48       ` Felipe Balbi
2010-10-05 15:01     ` Kevin Hilman [this message]
2010-10-05 15:01       ` Kevin Hilman
2010-10-06  6:33       ` Evgeny Kuznetsov
2010-10-06  6:33         ` Evgeny Kuznetsov
2010-10-08  7:49         ` Evgeny Kuznetsov

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=877hhwvg3r.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=EXT-Eugeny.Kuznetsov@nokia.com \
    --cc=a.j.buxton@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbi@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=zmc@lurian.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.