[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=WJQQsK4-okC+6HSPQp8q_ahVYFHXDBhigSLGYLvnEJjQ@mail.gmail.com>
Date: Fri, 20 Aug 2021 09:46:03 -0700
From: Doug Anderson <dianders@...omium.org>
To: jing yangyang <cgel.zte@...il.com>
Cc: Jason Wessel <jason.wessel@...driver.com>,
Daniel Thompson <daniel.thompson@...aro.org>,
Sumit Garg <sumit.garg@...aro.org>,
Will Deacon <will@...nel.org>,
Stephen Zhang <stephenzhangzsd@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
"Gustavo A . R . Silva" <gustavoars@...nel.org>,
kgdb-bugreport@...ts.sourceforge.net,
LKML <linux-kernel@...r.kernel.org>,
jing yangyang <jing.yangyang@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH linux-next] debug:kdb: fix unsigned int win compared to
less than zero
Hi,
On Thu, Aug 19, 2021 at 7:25 PM jing yangyang <cgel.zte@...il.com> wrote:
>
> Fix coccicheck warning:
> ./kernel/debug/kdb/kdb_support.c:575:3-10:
> WARNING:Unsigned expression compared with zero p_state < 0
>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: jing yangyang <jing.yangyang@....com.cn>
> ---
> kernel/debug/kdb/kdb_support.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c
> index c605b17..fb30801 100644
> --- a/kernel/debug/kdb/kdb_support.c
> +++ b/kernel/debug/kdb/kdb_support.c
> @@ -560,7 +560,7 @@ unsigned long kdb_task_state_string(const char *s)
> */
> char kdb_task_state_char (const struct task_struct *p)
> {
> - unsigned int p_state;
> + int p_state;
This was talked about:
https://www.mail-archive.com/kgdb-bugreport@lists.sourceforge.net/msg06159.html
There, Peter Zijlstra said:
> Pre-existing fail that.. but yes that code (and it's carbon copy in
> arch/powerpc/xmon/xmon.c) are clearly bogus and have been for a long
> time afaict.
>
> Ideally someone that cares about this code can replace it with
> get_task_state() or something.
...so while the warning was introduced by commit 2f064a59a11f ("sched:
Change task_struct::state") and your fix papers over of the warning,
it actually doesn't fix the real bug. Apparently the comment
describing the "state" variable before that commit was wrong and "-1"
didn't mean unrunnable.
Maybe you could submit a v2 that does what Peter suggests?
-Doug
Powered by blists - more mailing lists