lkml.org 
[lkml]   [2019]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 06/16] dyndbg: fix a BUG_ON in ddebug_describe_flags
From
Date


On 12/9/19 9:27 PM, 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 with a
> struct containing a known-big-enough string buffer, and passing it
> instead.
>
> Also simplify ddebug_describe_flags sig, and de-ref the struct in the
> caller; this makes function reusable (soon) in contexts where flags
> are already unpacked.
>
> -v3 fix compile err introduced in patchset grooming.
> Reported-by: kbuild test robot <lkp@intel.com>
>
> Signed-off-by: Jim Cromie <jim.cromie@gmail.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 b5fb0aa0fbc3..49cb24948e12 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -62,6 +62,8 @@ struct ddebug_iter {
> unsigned int idx;
> };
>
> +struct flagsbuf { char buf[12]; }; /* big enough to hold all the flags */


ARRAY_SIZE(opt_array) + 1

max number of flags + string termination.

\
 
 \ /
  Last update: 2019-12-10 20:58    [W:0.105 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site