Messages in this thread | | | Date | Mon, 14 Nov 2022 11:23:29 +0300 | From | Dan Carpenter <> | Subject | Re: [tip:sched/core 3/19] kernel/sched/fair.c:7263 find_energy_efficient_cpu() error: uninitialized symbol 'util_min'. |
| |
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
| |