[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202107011947.Z2uDK8Cg-lkp@intel.com>
Date: Thu, 1 Jul 2021 19:56:54 +0800
From: kernel test robot <lkp@...el.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Daniel Bristot de Oliveira <bristot@...hat.com>
Subject: kernel/debug/kdb/kdb_support.c:624 kdb_task_state_char() warn:
unsigned 'p_state' is never less than zero.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: dbe69e43372212527abf48609aba7fc39a6daa27
commit: 2f064a59a11ff9bc22e52e9678bc601404c7cb34 sched: Change task_struct::state
date: 13 days ago
config: microblaze-randconfig-m031-20210628 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
smatch warnings:
kernel/debug/kdb/kdb_support.c:624 kdb_task_state_char() warn: unsigned 'p_state' is never less than zero.
vim +/p_state +624 kernel/debug/kdb/kdb_support.c
602
603 /*
604 * kdb_task_state_char - Return the character that represents the task state.
605 * Inputs:
606 * p struct task for the process
607 * Returns:
608 * One character to represent the task state.
609 */
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' :
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 }
643
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (31343 bytes)
Powered by blists - more mailing lists