Re: [GIT PULL] x86/platform updates for v5.10
From: Borislav Petkov
Date: Mon Oct 12 2020 - 17:57:01 EST
On Mon, Oct 12, 2020 at 02:46:10PM -0700, Linus Torvalds wrote:
> At least "git grep" only shows two assignments to it.
>
> Of course, that would miss any cases that play games with preprocessor
> token pasting etc, so it's not entirely meaningful, but it's certainly
> a hint..
>From a quick staring at gcc asm, it looks write only. And gcc didn't
warn because it optimized that assignment away completely AFAICT.
> And yes, I expect that the fix is to just make it "unsigned long", but
> if it truly isn't actually used, maybe removal is better.
Yeah, below is a proper patch which builds fine with gcc and clang-10.
You guys have fun - I'm going to bed. :-)
---
From: Mike Travis <mike.travis@xxxxxxx>
Date: Mon, 12 Oct 2020 23:46:34 +0200
Subject: [PATCH] x86/platform/uv: Correct uvh_nmi_mmrx_mask's type
Clang rightfully warns:
arch/x86/platform/uv/uv_nmi.c:250:23: warning: implicit conversion
from 'unsigned long' to 'int' changes value from 1152921504606846976
to 0 [-Wconstant-conversion]
uvh_nmi_mmrx_mask = UVH_EVENT_OCCURRED0_EXTIO_INT0_MASK;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Make the variable unsigned long.
[ bp: Productize it. ]
Signed-off-by: Mike Travis <mike.travis@xxxxxxx>
Signed-off-by: Borislav Petkov <bp@xxxxxxx>
---
arch/x86/platform/uv/uv_nmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
index 0f5cbcf0da63..8566730f154d 100644
--- a/arch/x86/platform/uv/uv_nmi.c
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -59,7 +59,7 @@ DEFINE_PER_CPU(struct uv_cpu_nmi_s, uv_cpu_nmi);
static unsigned long uvh_nmi_mmrx; /* UVH_EVENT_OCCURRED0/1 */
static unsigned long uvh_nmi_mmrx_clear; /* UVH_EVENT_OCCURRED0/1_ALIAS */
static int uvh_nmi_mmrx_shift; /* UVH_EVENT_OCCURRED0/1_EXTIO_INT0_SHFT */
-static int uvh_nmi_mmrx_mask; /* UVH_EVENT_OCCURRED0/1_EXTIO_INT0_MASK */
+static unsigned long uvh_nmi_mmrx_mask; /* UVH_EVENT_OCCURRED0/1_EXTIO_INT0_MASK */
static char *uvh_nmi_mmrx_type; /* "EXTIO_INT0" */
/* Non-zero indicates newer SMM NMI handler present */
--
2.21.0
--
Regards/Gruss,
Boris.
SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg