mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Daniel Bristot de Oliveira <bristot@redhat.com>
Subject: kernel/debug/kdb/kdb_support.c:624 kdb_task_state_char() warn: unsigned 'p_state' is never less than zero.
Date: Thu, 1 Jul 2021 19:56:54 +0800	[thread overview]
Message-ID: <202107011947.Z2uDK8Cg-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2131 bytes --]

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@intel.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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31343 bytes --]

                 reply	other threads:[~2021-07-01 11:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202107011947.Z2uDK8Cg-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=bristot@redhat.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®