* [PATCH] sysctl: Use BUG_ON instead of BUG
@ 2012-09-03 3:30 Prasad Joshi
2012-09-04 23:18 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Prasad Joshi @ 2012-09-03 3:30 UTC (permalink / raw)
To: prasadjoshi.linux; +Cc: ebiederm, akpm, viro, lucas.demarchi, linux-kernel
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);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sysctl: Use BUG_ON instead of BUG
2012-09-03 3:30 [PATCH] sysctl: Use BUG_ON instead of BUG Prasad Joshi
@ 2012-09-04 23:18 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2012-09-04 23:18 UTC (permalink / raw)
To: Prasad Joshi; +Cc: ebiederm, viro, lucas.demarchi, linux-kernel
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().
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-04 23:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-03 3:30 [PATCH] sysctl: Use BUG_ON instead of BUG Prasad Joshi
2012-09-04 23:18 ` Andrew Morton
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).