From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Yafang Shao <laoar.shao@gmail.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>
Subject: [peterz-queue:sched/core 13/19] kernel/sched/debug.c:453 print_cfs_group_stats() warn: variable dereferenced before check 'se' (see line 444)
Date: Mon, 13 Sep 2021 11:47:51 +0300 [thread overview]
Message-ID: <202109111001.XChyxkS3-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
head: 2dfdb3d20ad50e2ae2cb84cbceb0f0fc75e79e5d
commit: 445d9e8ba05d5e9e4b26956b7fe529223e29d8d1 [13/19] sched: make struct sched_statistics independent of fair sched class
config: x86_64-randconfig-m001-20210910 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
kernel/sched/debug.c:453 print_cfs_group_stats() warn: variable dereferenced before check 'se' (see line 444)
vim +/se +453 kernel/sched/debug.c
3866e845ed5222 kernel/sched/debug.c Steven Rostedt (Red Hat 2016-02-22 439)
ff9b48c3598732 kernel/sched_debug.c Bharata B Rao 2008-11-10 440 #ifdef CONFIG_FAIR_GROUP_SCHED
5091faa449ee0b kernel/sched_debug.c Mike Galbraith 2010-11-30 441 static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group *tg)
ff9b48c3598732 kernel/sched_debug.c Bharata B Rao 2008-11-10 442 {
ff9b48c3598732 kernel/sched_debug.c Bharata B Rao 2008-11-10 443 struct sched_entity *se = tg->se[cpu];
445d9e8ba05d5e kernel/sched/debug.c Yafang Shao 2021-09-05 @444 struct sched_statistics *stats = __schedstats_from_se(se);
^^
New unchecked dereference.
ff9b48c3598732 kernel/sched_debug.c Bharata B Rao 2008-11-10 445
97fb7a0a8944bd kernel/sched/debug.c Ingo Molnar 2018-03-03 446 #define P(F) SEQ_printf(m, " .%-30s: %lld\n", #F, (long long)F)
445d9e8ba05d5e kernel/sched/debug.c Yafang Shao 2021-09-05 447 #define P_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld\n", \
445d9e8ba05d5e kernel/sched/debug.c Yafang Shao 2021-09-05 448 #F, (long long)schedstat_val(stats->F))
97fb7a0a8944bd kernel/sched/debug.c Ingo Molnar 2018-03-03 449 #define PN(F) SEQ_printf(m, " .%-30s: %lld.%06ld\n", #F, SPLIT_NS((long long)F))
445d9e8ba05d5e kernel/sched/debug.c Yafang Shao 2021-09-05 450 #define PN_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld.%06ld\n", \
445d9e8ba05d5e kernel/sched/debug.c Yafang Shao 2021-09-05 451 #F, SPLIT_NS((long long)schedstat_val(stats->F)))
ff9b48c3598732 kernel/sched_debug.c Bharata B Rao 2008-11-10 452
cd126afe838d7e kernel/sched/debug.c Yuyang Du 2015-07-15 @453 if (!se)
^^^
The old code assumed "se" can be NULL.
18bf2805d9b30c kernel/sched/debug.c Ben Segall 2012-10-04 454 return;
18bf2805d9b30c kernel/sched/debug.c Ben Segall 2012-10-04 455
ff9b48c3598732 kernel/sched_debug.c Bharata B Rao 2008-11-10 456 PN(se->exec_start);
ff9b48c3598732 kernel/sched_debug.c Bharata B Rao 2008-11-10 457 PN(se->vruntime);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
next reply other threads:[~2021-09-13 8:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 8:47 Dan Carpenter [this message]
2021-09-13 11:04 ` Yafang Shao
2021-09-13 12:02 ` Peter Zijlstra
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=202109111001.XChyxkS3-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=laoar.shao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--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®