All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kdb: Make the internal env 'KDBFLAGS' undefinable
@ 2020-05-11  2:16 Wei Li
  2020-05-13 23:41 ` Doug Anderson
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Li @ 2020-05-11  2:16 UTC (permalink / raw)
  To: Jason Wessel, Daniel Thompson, Douglas Anderson, Masahiro Yamada
  Cc: kgdb-bugreport, linux-kernel

'KDBFLAGS' is an internal variable of kdb, it is combined by 'KDBDEBUG'
and state flags. But the user can define an environment variable named
'KDBFLAGS' too, so let's make it undefinable to avoid confusion.

Signed-off-by: Wei Li <liwei391@huawei.com>
---
 kernel/debug/kdb/kdb_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 4fc43fb17127..d3d060136821 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -423,7 +423,8 @@ int kdb_set(int argc, const char **argv)
 			| (debugflags << KDB_DEBUG_FLAG_SHIFT);
 
 		return 0;
-	}
+	} else if (strcmp(argv[1], "KDBFLAGS") == 0)
+		return KDB_NOPERM;
 
 	/*
 	 * Tokenizer squashed the '=' sign.  argv[1] is variable
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kdb: Make the internal env 'KDBFLAGS' undefinable
  2020-05-11  2:16 [PATCH] kdb: Make the internal env 'KDBFLAGS' undefinable Wei Li
@ 2020-05-13 23:41 ` Doug Anderson
  2020-05-16  7:19   ` liwei (GF)
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Anderson @ 2020-05-13 23:41 UTC (permalink / raw)
  To: Wei Li
  Cc: Jason Wessel, Daniel Thompson, Masahiro Yamada, kgdb-bugreport, LKML

Hi,

On Sun, May 10, 2020 at 7:18 PM Wei Li <liwei391@huawei.com> wrote:
>
> 'KDBFLAGS' is an internal variable of kdb, it is combined by 'KDBDEBUG'
> and state flags. But the user can define an environment variable named
> 'KDBFLAGS' too, so let's make it undefinable to avoid confusion.
>
> Signed-off-by: Wei Li <liwei391@huawei.com>
> ---
>  kernel/debug/kdb/kdb_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index 4fc43fb17127..d3d060136821 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -423,7 +423,8 @@ int kdb_set(int argc, const char **argv)
>                         | (debugflags << KDB_DEBUG_FLAG_SHIFT);
>
>                 return 0;
> -       }
> +       } else if (strcmp(argv[1], "KDBFLAGS") == 0)
> +               return KDB_NOPERM;

One slight nit is that my personal preference is that if one half of
an "if/else" needs braces then both halves should have braces.  I
don't know what Daniel and Jason's policies are, though.  In any case,
not that I've ever used the KDBDEBUG functionality, but your change
seems sane.  Without it if I set "KDBDEBUG" and "KDBFLAGS" and then
type "env" I see the flags listed twice, but one is real and one is
fake.

Reviewed-by: Douglas Anderson <dianders@chromium.org>

-Doug

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kdb: Make the internal env 'KDBFLAGS' undefinable
  2020-05-13 23:41 ` Doug Anderson
@ 2020-05-16  7:19   ` liwei (GF)
  0 siblings, 0 replies; 3+ messages in thread
From: liwei (GF) @ 2020-05-16  7:19 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Jason Wessel, Daniel Thompson, Masahiro Yamada, kgdb-bugreport, LKML

Hi Douglas,

On 2020/5/14 7:41, Doug Anderson wrote:

>> -       }
>> +       } else if (strcmp(argv[1], "KDBFLAGS") == 0)
>> +               return KDB_NOPERM;
> 
> One slight nit is that my personal preference is that if one half of
> an "if/else" needs braces then both halves should have braces.  I
Thanks for spotting it. Refer to Documentation/process/coding-style.rst, i
will fix it in the v2.

> don't know what Daniel and Jason's policies are, though.  In any case,
> not that I've ever used the KDBDEBUG functionality, but your change
> seems sane.  Without it if I set "KDBDEBUG" and "KDBFLAGS" and then
> type "env" I see the flags listed twice, but one is real and one is
> fake.
> 
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> 
> -Doug
> 

Thanks,
Wei

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-16  7:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11  2:16 [PATCH] kdb: Make the internal env 'KDBFLAGS' undefinable Wei Li
2020-05-13 23:41 ` Doug Anderson
2020-05-16  7:19   ` liwei (GF)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.