lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210323025901.205381-1-xuyihang@huawei.com>
Date:   Tue, 23 Mar 2021 10:59:01 +0800
From:   Xu Yihang <xuyihang@...wei.com>
To:     <tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
        <x86@...nel.org>, <hpa@...or.com>, <tony.luck@...el.com>,
        <fenghua.yu@...el.com>, <rppt@...nel.org>, <xiaoyao.li@...el.com>,
        <seanjc@...gle.com>, <linux-kernel@...r.kernel.org>
CC:     <xuyihang@...wei.com>, <johnny.chenyi@...wei.com>
Subject: [PATCH -next] x86: Fix intel cpu unsed variable ‘l2’ warning

Fixes the following W=1 kernel build warning(s):
../arch/x86/kernel/cpu/intel.c: In function ‘init_intel’:
../arch/x86/kernel/cpu/intel.c:644:20: warning: variable ‘l2’ set but not used [-Wunused-but-set-variable]
   unsigned int l1, l2;
                    ^~

Compilation command(s):
make allmodconfig ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-
make W=1 arch/x86/kernel/cpu/intel.o ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-

According to Intel Software Developer's Manual Table 2-2 through Table 2-24 about MSRs:
X86_FEATURE_BTS which represents Branch Trace Storage Unavailable and X86_FEATURE_PEBS
represens Processor Event Based Sampling (PEBS) Unavailable, but on some platform these fields
maybe reserved or not available. For the function init_intel it self, only bit 11 and bit 12
are used for checking BTS and PEBS, and higher 32 bits are not used. So cast to void to
avoid warning.

Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Xu Yihang <xuyihang@...wei.com>
---
 arch/x86/kernel/cpu/intel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 63e381a46153..547ba6668eb3 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -644,6 +644,7 @@ static void init_intel(struct cpuinfo_x86 *c)
 		unsigned int l1, l2;
 
 		rdmsr(MSR_IA32_MISC_ENABLE, l1, l2);
+		(void) l2;
 		if (!(l1 & (1<<11)))
 			set_cpu_cap(c, X86_FEATURE_BTS);
 		if (!(l1 & (1<<12)))
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ