From patchwork Mon Mar 25 09:04:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10868413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF70C1708 for ; Mon, 25 Mar 2019 09:05:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6EA12906C for ; Mon, 25 Mar 2019 09:05:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6AD429134; Mon, 25 Mar 2019 09:05:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C20A2906C for ; Mon, 25 Mar 2019 09:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730102AbfCYJFR (ORCPT ); Mon, 25 Mar 2019 05:05:17 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47110 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730009AbfCYJFR (ORCPT ); Mon, 25 Mar 2019 05:05:17 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2P93pMX173196; Mon, 25 Mar 2019 09:04:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=lXD9HLzDv9hZor4tDK8E+zSoAnmPCP1iGd245YRj/Bo=; b=0lszoYi7pKtsQnjirMkCzTrWW//RbWDwKvYindi/lrucRKK5cIuQz6ush8VoIkkXIJZJ YC8b4t8xpRVqZKA93IcagOS17wKTYQyUf4wl9OYDvp4b7RYRnTafA01tWDBwl9rM8qj3 mT+QKzYEdFadqUPZdaT33UqUsn+/U3XHOCLC898oqOLC+6qcbd+BU2ZunYFUF1bbr1zM 4YgkTahjd0/5RT8AUazV4i9H3ucp+hQYP6uw+IP4as4ziKfQoal9/AaMAU/vNR46ZmLk jcbCQA0gnrd9fWQNbC4IBQkkViF9hA3gpUv/tprs4Ls4DX661RG26zLyIdnUZpFP4s4c wQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2re6g0jr9s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Mar 2019 09:04:58 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2P94w4Y024279 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Mar 2019 09:04:58 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x2P94uN4021449; Mon, 25 Mar 2019 09:04:56 GMT Received: from kadam (/197.157.34.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 25 Mar 2019 02:04:56 -0700 Date: Mon, 25 Mar 2019 12:04:48 +0300 From: Dan Carpenter To: Paolo Bonzini Cc: Radim =?utf-8?b?S3LEjW3DocWZ?= , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] kvm: vmx: Silence a shift wrap warning Message-ID: <20190325090448.GB16023@kadam> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9205 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=832 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903250069 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This code generates a Smatch warning: arch/x86/kvm/vmx/nested.c:4828 handle_vmfunc() warn: should '(1 << function)' be a 64 bit type? The warning is generated because "vmcs12->vm_function_control" is a u64 but the shift can only test the lower 32 bits. This doesn't cause a problem in the current code because we only use BIT(0). This patch just silences the static checker warning. Signed-off-by: Dan Carpenter Reviewed-by: David Hildenbrand --- arch/x86/kvm/vmx/nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index f24a2c225070..1f4398246bd9 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -4825,7 +4825,7 @@ static int handle_vmfunc(struct kvm_vcpu *vcpu) } vmcs12 = get_vmcs12(vcpu); - if ((vmcs12->vm_function_control & (1 << function)) == 0) + if ((vmcs12->vm_function_control & (1ULL << function)) == 0) goto fail; switch (function) {