From: Andrew Morton <akpm@linux-foundation.org>
To: Prasad Joshi <prasadjoshi.linux@gmail.com>
Cc: ebiederm@xmission.com, viro@zeniv.linux.org.uk,
lucas.demarchi@profusion.mobi, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysctl: Use BUG_ON instead of BUG
Date: Tue, 4 Sep 2012 16:18:55 -0700 [thread overview]
Message-ID: <20120904161855.f34e365e.akpm@linux-foundation.org> (raw)
In-Reply-To: <1346643025-2769-1-git-send-email-prasadjoshi.linux@gmail.com>
On Mon, 3 Sep 2012 09:00:25 +0530
Prasad Joshi <prasadjoshi.linux@gmail.com> wrote:
> The use of if (!head) BUG(); can be replaced with single line
> BUG_ON(!head).
>
> Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
> ---
> fs/proc/proc_sysctl.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index dfafeb2..63bdfa0 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -266,8 +266,7 @@ void sysctl_head_put(struct ctl_table_header *head)
>
> static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
> {
> - if (!head)
> - BUG();
> + BUG_ON(!head);
> spin_lock(&sysctl_lock);
> if (!use_table(head))
> head = ERR_PTR(-ENOENT);
We could just remove the check altogether. The resulting NULL pointer
deref oops in use_table() will give us the same info as that BUG().
prev parent reply other threads:[~2012-09-04 23:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-03 3:30 [PATCH] sysctl: Use BUG_ON instead of BUG Prasad Joshi
2012-09-04 23:18 ` Andrew Morton [this message]
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=20120904161855.f34e365e.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@profusion.mobi \
--cc=prasadjoshi.linux@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).