Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7442631imu; Mon, 3 Dec 2018 13:02:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/VoovRxTt3yHp22UMlJtYIPwdRXNX6BaWIcoq14d1gdyQj6MLz6t1j9c5LW75QRlZXh/HMP X-Received: by 2002:a62:546:: with SMTP id 67mr16980111pff.99.1543870940753; Mon, 03 Dec 2018 13:02:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543870940; cv=none; d=google.com; s=arc-20160816; b=tJgUxbgWyGuEOPJPOGuezhefhLS7vmnNYvT+r2ZkFL1J2jdr73Q3FiGx/TT1jXVzkR 9cyNUEoZ9QDulsNQ7E4ZpKfjDqC8A+XHPK6ccwKiB+aeEleVY3F8eaOgMkyA5rZeuPpx D/XUp/ouSpE0cJim85Q7Btm6+fnr9zxRo0V5xkaYe7akB2DWnJXT5ZAIkfi74GsJOESo IlBytqGFiSxVgb6Z0hW5HbWAI/9ee3TpYTfWbrTGz/DOebEsGsV6CogPR//tQ4glKTIj cAvjRpTXg1R4myFYdh81FUcmKB2Eeg3IFMLhYYqGIodHph4fUbA1BrjllLh5tqnBEAdu 1r5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=vbhxnNLoi9gkG3X9FvxlKJxd3x2s+Tr/3Ad9XpztBk4=; b=Rk+vpPzs/BW6oFz/X5RK60h8S5FbXPyzxElWZ3MPw2J/vvpuOdvl28/UfXwmgF63Xk 5BaYn5w94/7A0OPrSuzvslEDGwbb+3ROWZdtzOHgsFevjOOYQjKzwUsJXvr8erTiQ9p4 4D8R/aVH5ZUE+Ym4tC0DxbGfWpBWscLnF79JxkhzDtFbL1cV8VfPZeuR9aI7oF38EXZD xwCFabyXnq54cAHbH2rx7zbzBN7JSWfkYKtCxvbkfx2uA5LTmezD9Yv+Wa1qfRKx2DxW m2YmDY/xpovWJzE/3UQjumLX8PnMS7uKHS7idDXw7A2EuX8CKgk/R2LypcVxBm8MvCWL et5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f127si7911810pfc.69.2018.12.03.13.02.02; Mon, 03 Dec 2018 13:02:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726029AbeLCVBU (ORCPT + 99 others); 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 X-Spam-Status: No, score=-0.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com 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; }