[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200615132028.GE31238@alley>
Date: Mon, 15 Jun 2020 15:20:28 +0200
From: Petr Mladek <pmladek@...e.com>
To: Jim Cromie <jim.cromie@...il.com>
Cc: jbaron@...mai.com, linux-kernel@...r.kernel.org,
akpm@...uxfoundation.org, gregkh@...uxfoundation.org,
linux@...musvillemoes.dk
Subject: Re: [PATCH v2 07/24] dyndbg: fix a BUG_ON in ddebug_describe_flags
On Sat 2020-06-13 09:57:21, Jim Cromie wrote:
> ddebug_describe_flags currently fills a caller provided string buffer,
> after testing its size (also passed) in a BUG_ON. Fix this by
> replacing them with a known-big-enough string buffer wrapped in a
> struct, and passing that instead.
>
> Also simplify the flags parameter, and instead de-ref the flags struct
> in the caller; this makes the function reusable (soon) where flags are
> unpacked.
In all patches is missing:
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
> ---
> lib/dynamic_debug.c | 31 +++++++++++++++----------------
> 1 file changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index 9b2445507988..aaace13d7536 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -87,22 +87,22 @@ static struct { unsigned flag:8; char opt_char; } opt_array[] = {
> { _DPRINTK_FLAGS_NONE, '_' },
> };
>
> +struct flagsbuf { char buf[ARRAY_SIZE(opt_array)+1]; };
This looks too complicated. What about?
typedef char flags_buf[ARRAY_SIZE(opt_array) + 1];
used as
flags_buf fb;
#define FLAGS_BUF_SIZE (ARRAY_SIZE(opt_array) + 1)
used as
char flags_buf[FLAGS_BUF_SIZE];
Best Regards,
Petr
Powered by blists - more mailing lists