lkml.org 
[lkml]   [2006]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] i386: handle_BUG(): don't print garbage if debug info unavailable
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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-11 18:53    [W:0.059 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site