Hello Peter Zijlstra,
The patch 2f064a59a11f: "sched: Change task_struct::state" from Jun
11, 2021, leads to the following static checker warning:
kernel/debug/kdb/kdb_support.c:624 kdb_task_state_char()
warn: unsigned 'p_state' is never less than zero.
kernel/debug/kdb/kdb_support.c
610 char kdb_task_state_char (const struct task_struct *p)
611 {
612 unsigned int p_state;
^^^^^^^^^^^^^^^^^^^^
613 unsigned long tmp;
614 char state;
615 int cpu;
616
617 if (!p ||
618 copy_from_kernel_nofault(&tmp, (char *)p, sizeof(unsigned
long)))
619 return 'E';
620
621 cpu = kdb_process_cpu(p);
622 p_state = READ_ONCE(p->__state);
623 state = (p_state == 0) ? 'R' :
624 (p_state < 0) ? 'U' :
^^^^^^^^^^^
Impossible
625 (p_state & TASK_UNINTERRUPTIBLE) ? 'D' :
626 (p_state & TASK_STOPPED) ? 'T' :
627 (p_state & TASK_TRACED) ? 'C' :
628 (p->exit_state & EXIT_ZOMBIE) ? 'Z' :
629 (p->exit_state & EXIT_DEAD) ? 'E' :
630 (p_state & TASK_INTERRUPTIBLE) ? 'S' : '?';
631 if (is_idle_task(p)) {
632 /* Idle task. Is it really idle, apart from the kdb
633 * interrupt? */
634 if (!kdb_task_has_cpu(p) || kgdb_info[cpu].irq_depth ==
1) {
635 if (cpu != kdb_initial_cpu)
636 state = 'I'; /* idle task */
637 }
638 } else if (!p->mm && state == 'S') {
639 state = 'M'; /* sleeping system daemon */
640 }
641 return state;
642 }
regards,
dan carpenter
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport