Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275211

[PATCH 6/6] x86/MSR: Chop off lower 32-bit value

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject [PATCH 6/6] x86/MSR: Chop off lower 32-bit value
Date 2015-11-23 11:20 +0100
Message-ID <qxWo2-pd-17@gated-at.bofh.it> (permalink)
References <qxWo2-pd-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Borislav Petkov <bp@suse.de>

sparse complains that the cast truncates the high bits. But here we
really do know what we're doing and we need the lower 32 bits only as
the @low argument. So make that explicit.

Signed-off-by: Borislav Petkov <bp@suse.de>
Suggested-by: Andy Lutomirski <luto@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/msr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 77d8b284e4a7..86133827c75c 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -190,7 +190,7 @@ static inline void wrmsr(unsigned msr, unsigned low, unsigned high)
 
 static inline void wrmsrl(unsigned msr, u64 val)
 {
-	native_write_msr(msr, (u32)val, (u32)(val >> 32));
+	native_write_msr(msr, (u32)(val & 0xffffffffULL), (u32)(val >> 32));
 }
 
 /* wrmsr with exception handling */
-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] tip-queue 2015-11-23 Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
  [PATCH 1/6] x86/cpu: Unify CPU family, model, stepping calculation Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
    [tip:x86/cpu] x86/cpu: Unify CPU family, model,   stepping calculation tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100
  [PATCH 6/6] x86/MSR: Chop off lower 32-bit value Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
    [tip:x86/cpu] x86/MSR: Chop off lower 32-bit value tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100
  [PATCH 2/6] kvm: Add accessors for guest CPU's family, model, stepping Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
    [tip:x86/cpu] kvm: Add accessors for guest CPU's family, model,   stepping tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100
  [PATCH 3/6] x86/cpu/amd, kvm: Satisfy guest kernel reads of IC_CFG MSR Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
    [tip:x86/cpu] x86/cpu/amd, kvm:   Satisfy guest kernel reads of IC_CFG MSR tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100
  [PATCH 5/6] x86/cpu: Fix MSR value truncation issue Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
    [tip:x86/cpu] x86/cpu: Fix MSR value truncation issue tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100

csiph-web