From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753341AbbJaLqr (ORCPT ); Sat, 31 Oct 2015 07:46:47 -0400 Received: from mail.skyhub.de ([78.46.96.112]:37046 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753123AbbJaLqn (ORCPT ); Sat, 31 Oct 2015 07:46:43 -0400 Date: Sat, 31 Oct 2015 12:46:28 +0100 From: Borislav Petkov To: Andy Lutomirski Cc: LKML , Andy Lutomirski , "H. Peter Anvin" , Ingo Molnar , Linus Torvalds , Peter Zijlstra , Thomas Gleixner Subject: [PATCH] x86/MSR: Chop off lower 32-bit value Message-ID: <20151031114628.GA8763@pd.tnic> References: <1446226105-13384-1-git-send-email-bp@alien8.de> <20151030192329.GJ20952@pd.tnic> <20151030193253.GK20952@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20151030193253.GK20952@pd.tnic> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 30, 2015 at 08:32:53PM +0100, Borislav Petkov wrote: > On Fri, Oct 30, 2015 at 12:26:42PM -0700, Andy Lutomirski wrote: > > Want to add that to the patch or make it another patch? > > Yeah, I'll make another one as it is going to document why we're > explicitly ANDing with 0xffffffffull. --- >>From 89bfdb82447fd5c9f5bd9753040a639364b0c9d2 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Sat, 31 Oct 2015 12:40:48 +0100 Subject: [PATCH] x86/MSR: Chop off lower 32-bit value 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 Cc: Andy Lutomirski Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner --- 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 -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.