lkml.org 
[lkml]   [2016]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: BUG and WARN kernel log levels
From
Date
On Mon, 2016-08-15 at 11:53 -0700, Kees Cook wrote:
> Hi,
>
> So, I noticed that asm-gemeric/bug.h defines BUG() without a log level:
>
> #ifndef HAVE_ARCH_BUG
> #define BUG() do { \
>        printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
>
> Seems like it should have one?
>
> Also, I think we might want to examine WARN() a bit... it doesn't have
> a log level either, but only a fraction of callers set one:
>
> $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep -v KERN_ | wc -l
> 2735
>
> $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep KERN_ | wc -l
> 77
>
> If I'm reading checkpatch.pl correctly, it doesn't warn about missing
> log levels on WARN calls, but I think it should.
>
> How do you think is best to clean this up?
>
> Mainly, I'd like to add a format string to BUG, or introduce a new
> BUGish call that takes a format...

I once suggested something similar awhile ago.
https://lkml.org/lkml/2008/7/8/261

I think it's best to remove any KERN_<LEVEL> from the use of
all the WARN variants and add it to the WARN definitions.

Same with BUG.

\
 
 \ /
  Last update: 2016-09-17 09:57    [W:0.071 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site