From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00D8BC04EB9 for ; Mon, 3 Dec 2018 21:01:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C167B20850 for ; Mon, 3 Dec 2018 21:01:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C167B20850 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zytor.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726037AbeLCVBU (ORCPT ); Mon, 3 Dec 2018 16:01:20 -0500 Received: from terminus.zytor.com ([198.137.202.136]:56831 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725903AbeLCVBU (ORCPT ); Mon, 3 Dec 2018 16:01:20 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id wB3L0uJM594262 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 3 Dec 2018 13:00:56 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id wB3L0tO4594259; Mon, 3 Dec 2018 13:00:55 -0800 Date: Mon, 3 Dec 2018 13:00:55 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Sebastian Andrzej Siewior Message-ID: Cc: rkrcmar@redhat.com, riel@surriel.com, x86@kernel.org, pbonzini@redhat.com, tglx@linutronix.de, Jason@zx2c4.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, luto@kernel.org, dave.hansen@linux.intel.com, bigeasy@linutronix.de, mingo@kernel.org, mingo@redhat.com, bp@suse.de, hpa@zytor.com Reply-To: riel@surriel.com, tglx@linutronix.de, x86@kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, linux-kernel@vger.kernel.org, Jason@zx2c4.com, mingo@redhat.com, mingo@kernel.org, kvm@vger.kernel.org, luto@kernel.org, bigeasy@linutronix.de, dave.hansen@linux.intel.com, hpa@zytor.com, bp@suse.de In-Reply-To: <20181128222035.2996-2-bigeasy@linutronix.de> References: <20181128222035.2996-2-bigeasy@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu: Use unsigned long long shift in xfeature_uncompacted_offset() Git-Commit-ID: d08452390179710dc7989242605e3c1faa62b64f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d08452390179710dc7989242605e3c1faa62b64f Gitweb: https://git.kernel.org/tip/d08452390179710dc7989242605e3c1faa62b64f Author: Sebastian Andrzej Siewior AuthorDate: Wed, 28 Nov 2018 23:20:07 +0100 Committer: Borislav Petkov CommitDate: Mon, 3 Dec 2018 18:40:28 +0100 x86/fpu: Use unsigned long long shift in xfeature_uncompacted_offset() The xfeature mask is 64-bit so a shift from a number to its mask should have ULL suffix or else bits above position 31 will be lost. This is not a problem now but should XFEATURE_MASK_SUPERVISOR gain a bit >31 then this check won't catch it. Use BIT_ULL() to compute a mask from a number. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Borislav Petkov Reviewed-by: Rik van Riel Cc: "H. Peter Anvin" Cc: "Jason A. Donenfeld" Cc: Andy Lutomirski Cc: Dave Hansen Cc: Ingo Molnar Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Thomas Gleixner Cc: kvm ML Cc: x86-ml Link: https://lkml.kernel.org/r/20181128222035.2996-2-bigeasy@linutronix.de --- arch/x86/kernel/fpu/xstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 87a57b7642d3..69d5740ed254 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -444,7 +444,7 @@ static int xfeature_uncompacted_offset(int xfeature_nr) * format. Checking a supervisor state's uncompacted offset is * an error. */ - if (XFEATURE_MASK_SUPERVISOR & (1 << xfeature_nr)) { + if (XFEATURE_MASK_SUPERVISOR & BIT_ULL(xfeature_nr)) { WARN_ONCE(1, "No fixed offset for xstate %d\n", xfeature_nr); return -1; }