Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: [tip:x86/microcode 1/1] arch/x86/kernel/cpu/microcode/amd.c:714:6: warning: variable 'equiv_id' is used uninitialized whenever 'if' condition is false
Date: Mon, 29 Jul 2024 19:04:51 +0800	[thread overview]
Message-ID: <202407291815.gJBST0P3-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/microcode
head:   94838d230a6c835ced1bad06b8759e0a5f19c1d3
commit: 94838d230a6c835ced1bad06b8759e0a5f19c1d3 [1/1] x86/microcode/AMD: Use the family,model,stepping encoded in the patch ID
config: i386-buildonly-randconfig-001-20240729 (https://download.01.org/0day-ci/archive/20240729/202407291815.gJBST0P3-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240729/202407291815.gJBST0P3-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/202407291815.gJBST0P3-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/cpu/microcode/amd.c:714:6: warning: variable 'equiv_id' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     714 |         if (x86_family(bsp_cpuid_1_eax) < 0x17) {
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/cpu/microcode/amd.c:720:31: note: uninitialized use occurs here
     720 |         return cache_find_patch(uci, equiv_id);
         |                                      ^~~~~~~~
   arch/x86/kernel/cpu/microcode/amd.c:714:2: note: remove the 'if' if its condition is always true
     714 |         if (x86_family(bsp_cpuid_1_eax) < 0x17) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/cpu/microcode/amd.c:706:14: note: initialize the variable 'equiv_id' to silence this warning
     706 |         u16 equiv_id;
         |                     ^
         |                      = 0
   1 warning generated.


vim +714 arch/x86/kernel/cpu/microcode/amd.c

   701	
   702	static struct ucode_patch *find_patch(unsigned int cpu)
   703	{
   704		struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
   705		u32 rev, dummy __always_unused;
   706		u16 equiv_id;
   707	
   708		/* fetch rev if not populated yet: */
   709		if (!uci->cpu_sig.rev) {
   710			rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
   711			uci->cpu_sig.rev = rev;
   712		}
   713	
 > 714		if (x86_family(bsp_cpuid_1_eax) < 0x17) {
   715			equiv_id = find_equiv_id(&equiv_table, uci->cpu_sig.sig);
   716			if (!equiv_id)
   717				return NULL;
   718		}
   719	
   720		return cache_find_patch(uci, equiv_id);
   721	}
   722	

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

             reply	other threads:[~2024-07-29 11:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 11:04 kernel test robot [this message]
2024-07-29 11:26 ` [tip:x86/microcode 1/1] arch/x86/kernel/cpu/microcode/amd.c:714:6: warning: variable 'equiv_id' is used uninitialized whenever 'if' condition is false Borislav Petkov
2024-07-29 15:30   ` Nathan Chancellor
2024-07-29 16:50     ` Borislav Petkov
2024-07-30  1:43       ` Nathan Chancellor
2024-07-30  8:03     ` Borislav Petkov
2024-07-30 18:32       ` Nathan Chancellor

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=202407291815.gJBST0P3-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --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