All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [intel-linux-intel-lts:5.4/yocto 1/2] arch/x86/kernel/tsc.c:1263:6: warning: variable 'rem' is used uninitialized whenever 'if' condition is false
Date: Fri, 25 Jun 2021 23:46:19 +0800	[thread overview]
Message-ID: <202106252315.NmbMx929-lkp@intel.com> (raw)

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

tree:   https://github.com/intel/linux-intel-lts.git 5.4/yocto
head:   53cbd8c20c3f8e8afcc3482e6dd4c9400fc77dcd
commit: 056abbf6314ea7d95396062560c605f172e7535e [1/2] ptp: PSE TGPIO IOCTLs fix
config: x86_64-randconfig-r013-20210625 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9ca0171a9ffdef5fdb1511d197a3fd72490362de)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/intel/linux-intel-lts/commit/056abbf6314ea7d95396062560c605f172e7535e
        git remote add intel-linux-intel-lts https://github.com/intel/linux-intel-lts.git
        git fetch --no-tags intel-linux-intel-lts 5.4/yocto
        git checkout 056abbf6314ea7d95396062560c605f172e7535e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/tsc.c:1263:6: warning: variable 'rem' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (art_to_tsc_numerator)
               ^~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/tsc.c:1267:8: note: uninitialized use occurs here
           tmp = rem * art_to_tsc_denominator;
                 ^~~
   arch/x86/kernel/tsc.c:1263:2: note: remove the 'if' if its condition is always true
           if (art_to_tsc_numerator)
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/tsc.c:1257:19: note: initialize the variable 'rem' to silence this warning
           u64 tmp, res, rem;
                            ^
                             = 0
   1 warning generated.


vim +1263 arch/x86/kernel/tsc.c

  1244	
  1245	/**
  1246	 * convert_tsc_to_art() - Returns ART value associated with system counter
  1247	 *
  1248	 * Converts input TSC to the corresponding ART value using conversion
  1249	 * factors discovered by detect_art()
  1250	 *
  1251	 * Return:
  1252	 * u64 ART value
  1253	 */
  1254	int convert_tsc_to_art(const struct system_counterval_t *system_counter,
  1255			       u64 *art)
  1256	{
  1257		u64 tmp, res, rem;
  1258	
  1259		if (system_counter->cs != art_related_clocksource)
  1260			return -EINVAL;
  1261	
  1262		res = system_counter->cycles - art_to_tsc_offset;
> 1263		if (art_to_tsc_numerator)
  1264			rem = do_div(res, art_to_tsc_numerator);
  1265	
  1266		*art = res * art_to_tsc_denominator;
  1267		tmp = rem * art_to_tsc_denominator;
  1268	
  1269		if (art_to_tsc_numerator)
  1270			do_div(tmp, art_to_tsc_numerator);
  1271		*art += tmp;
  1272	
  1273		return 0;
  1274	}
  1275	EXPORT_SYMBOL(convert_tsc_to_art);
  1276	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

                 reply	other threads:[~2021-06-25 15:46 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=202106252315.NmbMx929-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.