mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Qais Yousef <qyousef@layalina.io>
Cc: oe-kbuild@lists.linux.dev, Qais Yousef <qais.yousef@arm.com>,
	lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [tip:sched/core 3/19] kernel/sched/fair.c:7263 find_energy_efficient_cpu() error: uninitialized symbol 'util_min'.
Date: Mon, 14 Nov 2022 11:23:29 +0300	[thread overview]
Message-ID: <Y3H7AcgnGMq5p+nn@kadam> (raw)
In-Reply-To: <20221112174705.pymjyzr4nqhkqfoc@airbuntu>

On Sat, Nov 12, 2022 at 05:47:05PM +0000, Qais Yousef wrote:
> On 11/12/22 13:16, Dan Carpenter wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
> > head:   52b33d87b9197c51e8ffdc61873739d90dd0a16f
> > commit: 244226035a1f9b2b6c326e55ae5188fab4f428cb [3/19] sched/uclamp: Fix fits_capacity() check in feec()
> > config: riscv-randconfig-m031-20221111
> > compiler: riscv64-linux-gcc (GCC) 12.1.0
> > 
> > If you fix the issue, kindly add following tag where applicable
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Reported-by: Dan Carpenter <error27@gmail.com>
> > 
> > smatch warnings:
> > kernel/sched/fair.c:7263 find_energy_efficient_cpu() error: uninitialized symbol 'util_min'.
> > kernel/sched/fair.c:7263 find_energy_efficient_cpu() error: uninitialized symbol 'util_max'.
> > 
> > vim +/util_min +7263 kernel/sched/fair.c
> 
> [...]
> 
> > util_min/max not initialized if uclamp_is_used() is false.  (I thought
> > I had reported this earlier but I don't see it on vger).
> 
> Thanks Dan!
> 
> It's harmless since util_min/max are ignored in util_fits_cpu() too;
> uclamp_is_used() is checked there as well.
> 
> I couldn't reproduce, I need to get GCC 12.1.0, but the below ought to cure it.
> Let me test it a bit more and send a patch.

In that case it's fine.  This is inlined.  I guess, generally, we are
going to only consider passing uninitialized variables to functions as
bugs when the functions are not inlined.  I believe that one of the
KMsan things will trigger a warning at runtime for this as well but it's
the same situation, where it's considered a false positive because it's
inlined.  (Technically it's undefined behavior either way according to
the C standard, but the standard is sometimes useless).

It's not a GCC warning, it's from Smatch.

GCC uninitialized warnings were disabled by defualt because they have
too many false positives.  Use "make W=2" to enable them.  GCC will
complain.

regards,
dan carpenter


  reply	other threads:[~2022-11-14  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-12 10:16 Dan Carpenter
2022-11-12 17:47 ` Qais Yousef
2022-11-14  8:23   ` Dan Carpenter [this message]
2022-11-20 20:45     ` Qais Yousef

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=Y3H7AcgnGMq5p+nn@kadam \
    --to=error27@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=qais.yousef@arm.com \
    --cc=qyousef@layalina.io \
    --cc=x86@kernel.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®