Hi, On Thu, Aug 19, 2021 at 7:25 PM jing yangyang <cgel....@gmail.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 <zea...@zte.com.cn> > Signed-off-by: jing yangyang <jing.yangy...@zte.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 _______________________________________________ Kgdb-bugreport mailing list Kgdb-bugreport@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport