mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@osdl.org>
Cc: Chuck Ebbert <76306.1226@compuserve.com>,
	linux-kernel@vger.kernel.org, torvalds@osdl.org, efault@gmx.de
Subject: Re: [patch] i386: handle_BUG(): don't print garbage if debug info unavailable
Date: Tue, 11 Jul 2006 20:52:13 +1000	[thread overview]
Message-ID: <44B382DD.5070202@yahoo.com.au> (raw)
In-Reply-To: <20060711012755.59965932.akpm@osdl.org>

Andrew Morton wrote:

> I think we can do it a lot more tidily.
> 
> static void handle_BUG(struct pt_regs *regs)
> {
> 	unsigned long eip = regs->eip;
> 	unsigned short ud2;
> 
> 	if (eip < PAGE_OFFSET)
> 		return;
> 	if (__get_user(ud2, (unsigned short __user *)eip))
> 		return;
> 	if (ud2 != 0x0b0f)
> 		return;
> 
> 	printk(KERN_EMERG "------------[ cut here ]------------\n");
> 
> #ifdef CONFIG_DEBUG_BUGVERBOSE
> 	do {
> 		unsigned short line;
> 		char *file;
> 		char c;
> 
> 		if (__get_user(line, (unsigned short __user *)(eip + 2)))
> 			break;
> 		if (__get_user(file, (char * __user *)(eip + 4)) ||
> 		    (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
> 			file = "<bad filename>";
> 
> 		printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line);
> 		return;
> 	} while (0);
> #endif
> 	printk(KERN_EMERG "Kernel BUG at [verbose debug info unavailable]\n");
> }
> 
> 
> OK?

OK but you don't need a do/while(0) here.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

  reply	other threads:[~2006-07-11 16:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-10 14:30 Chuck Ebbert
2006-07-11  8:27 ` Andrew Morton
2006-07-11 10:52   ` Nick Piggin [this message]
2006-07-11 17:02     ` Linus Torvalds
2006-07-11 17:58       ` Ray Lee
2006-07-11 23:42       ` Andrew Morton
2006-07-11 23:55         ` Linus Torvalds

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=44B382DD.5070202@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=76306.1226@compuserve.com \
    --cc=akpm@osdl.org \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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

Powered by JetHome