Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [thomas-weissschuh:b4/auxclock-nanosleep 17/44] kernel/time/benchmarks.c:65:8: warning: variable 'b' is used uninitialized whenever 'if' condition is true
@ 2026-04-29 21:23 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-04-29 21:23 UTC (permalink / raw)
  To: Thomas Weißschuh (Schneider Electric); +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/thomas.weissschuh/linux.git b4/auxclock-nanosleep
head:   3e5442acb7e21f08c3eff2ecdace624b6647d5b1
commit: 2d4cde60596e5113f58afbb253423ffcabc891ac [17/44] benchmarks
config: arm-allnoconfig (https://download.01.org/0day-ci/archive/20260430/202604300558.Y15GkXgc-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260430/202604300558.Y15GkXgc-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604300558.Y15GkXgc-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> kernel/time/benchmarks.c:65:8: warning: variable 'b' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
      65 |                         if (!ktime_get_aux(CLOCK_AUX, &a)) {
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/benchmarks.c:76:13: note: uninitialized use occurs here
      76 |                 *sample = b - a;
         |                           ^
   kernel/time/benchmarks.c:65:4: note: remove the 'if' if its condition is always false
      65 |                         if (!ktime_get_aux(CLOCK_AUX, &a)) {
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      66 |                                 *sample = KTIME_MAX;
         |                                 ~~~~~~~~~~~~~~~~~~~~
      67 |                                 continue;
         |                                 ~~~~~~~~~
      68 |                         }
         |                         ~
   kernel/time/benchmarks.c:62:15: note: initialize the variable 'b' to silence this warning
      62 |                 ktime_t a, b;
         |                             ^
         |                              = 0
   1 warning generated.


vim +65 kernel/time/benchmarks.c

    57	
    58	static void benchmark_ktime_get_aux(struct benchmark_samples *samples)
    59	{
    60		for (size_t l = 0; l < ARRAY_SIZE(samples->d); l++) {
    61			ktime_t *sample = &samples->d[l];
    62			ktime_t a, b;
    63	
    64			scoped_guard(preempt) {
  > 65				if (!ktime_get_aux(CLOCK_AUX, &a)) {
    66					*sample = KTIME_MAX;
    67					continue;
    68				}
    69	
    70				if (!ktime_get_aux(CLOCK_AUX, &b)) {
    71					*sample = KTIME_MAX;
    72					continue;
    73				}
    74			}
    75	
    76			*sample = b - a;
    77		}
    78	}
    79	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [thomas-weissschuh:b4/auxclock-nanosleep 17/44] kernel/time/benchmarks.c:65:8: warning: variable 'b' is used uninitialized whenever 'if' condition is true
@ 2026-04-30  1:19 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-04-30  1:19 UTC (permalink / raw)
  To: Thomas Weißschuh (Schneider Electric); +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/thomas.weissschuh/linux.git b4/auxclock-nanosleep
head:   3e5442acb7e21f08c3eff2ecdace624b6647d5b1
commit: 2d4cde60596e5113f58afbb253423ffcabc891ac [17/44] benchmarks
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260430/202604300314.gaiQVLYr-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260430/202604300314.gaiQVLYr-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604300314.gaiQVLYr-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> kernel/time/benchmarks.c:65:8: warning: variable 'b' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
      65 |                         if (!ktime_get_aux(CLOCK_AUX, &a)) {
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/benchmarks.c:76:13: note: uninitialized use occurs here
      76 |                 *sample = b - a;
         |                           ^
   kernel/time/benchmarks.c:65:4: note: remove the 'if' if its condition is always false
      65 |                         if (!ktime_get_aux(CLOCK_AUX, &a)) {
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      66 |                                 *sample = KTIME_MAX;
         |                                 ~~~~~~~~~~~~~~~~~~~~
      67 |                                 continue;
         |                                 ~~~~~~~~~
      68 |                         }
         |                         ~
   kernel/time/benchmarks.c:62:15: note: initialize the variable 'b' to silence this warning
      62 |                 ktime_t a, b;
         |                             ^
         |                              = 0
   1 warning generated.


vim +65 kernel/time/benchmarks.c

    57	
    58	static void benchmark_ktime_get_aux(struct benchmark_samples *samples)
    59	{
    60		for (size_t l = 0; l < ARRAY_SIZE(samples->d); l++) {
    61			ktime_t *sample = &samples->d[l];
    62			ktime_t a, b;
    63	
    64			scoped_guard(preempt) {
  > 65				if (!ktime_get_aux(CLOCK_AUX, &a)) {
    66					*sample = KTIME_MAX;
    67					continue;
    68				}
    69	
    70				if (!ktime_get_aux(CLOCK_AUX, &b)) {
    71					*sample = KTIME_MAX;
    72					continue;
    73				}
    74			}
    75	
    76			*sample = b - a;
    77		}
    78	}
    79	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-30  1:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-29 21:23 [thomas-weissschuh:b4/auxclock-nanosleep 17/44] kernel/time/benchmarks.c:65:8: warning: variable 'b' is used uninitialized whenever 'if' condition is true kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-04-30  1:19 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox