lkml.org 
[lkml]   [2016]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/5] bug: Provide toggle for BUG on data corruption
On Tue, 16 Aug 2016 17:53:54 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:


> WARN(1, "list_del corruption. next->prev should be %p, but was %p\n",
> entry, next->prev);
> BUG_ON(CORRUPTED_DATA_STRUCTURE);
>
> Will always warn (as stated by "1") and and the BUG_ON() will bug if
> CORRUPTED_DATA_STRUCTURE is set. Although, I don't like that name. Can
> we have a:
>
> BUG_ON(BUG_ON_CORRUPTED_DATA_STRUCTURES);
>
> Or maybe have that as a macro:
>
> #ifdef CONFIG_BUG_ON_CORRUPTION
> # define BUG_ON_CORRUPTED_DATA_STRUCTURE() BUG_ON(1)
> #else
> # define BUG_ON_CORRUPTED_DATA_STRUCTURE() do {} while (0)
> #endif
>
> Then we can have:
>
> WARN(1, "list_del corruption. next->prev should be %p, but was %p\n",
> entry, next->prev);
> BUG_ON_CORRUPTED_DATA_STRUCTURE();
>
> ??
>

Hmm, maybe better yet, just have it called "CORRUPTED_DATA_STRUCTURE()"
because it wont bug if the config is not set, and having "BUG_ON" in
the name, it might be somewhat confusing.

-- Steve

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