Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp649582rwe; Wed, 31 Aug 2022 08:41:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR5agDwvYL9KEFWuq0fZ+DNXWMXvyjHBekfgltgG4JzY3xsCOnuOVCpSTXFAe52bHzctLER+ X-Received: by 2002:a17:907:d27:b0:741:4151:1b71 with SMTP id gn39-20020a1709070d2700b0074141511b71mr15317046ejc.652.1661960480618; Wed, 31 Aug 2022 08:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661960480; cv=none; d=google.com; s=arc-20160816; b=yKLgLw4C4jd7qwSPsxyc2R2ZYbk4LAvitP8whYpaqdAjLCKeYB1efLs5MlYcsF1T/W JeaQLSkVH4LuJBaubWpmjHhsGX3YNsYbATLE7Glj3nFaTsiJXM1cYFL6PrRlzICNv+Is OGmPVmUCbP/uFXLqmT+eIBC2xrH1ZcmBVJlCt+PLrOIje5QIdRyAwYax3rH7ukny3KlG p+ZhsUpP72Yln/0h4SA8hwDPYlUojYZ+KZbHjxtNR0Io7j5CDSe1UXeY+8iq/v4xmLm1 XhVJLezcGLpHeu8rZVgoacSd6gTNWUyKopiHnZfVPeHckLrJ11Py4W/RcZyFrDQV00XF W7pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=8lifCs+Vpucok23R/oaopnqzvPUcXxy686872IvWQRg=; b=tHX6Ta7Z8HzwxiKTGwICPJASi53v+5yI+hNKL3ycpC7EA3QzOOzNDCIW1uK/N8qCst ybUdDjhLUOjDLRugOEyNMUahRro4HTqAuTSoTE3Q8lLTA8ZjOiRpvtr6uGciKDL1tvEO XM4XncSOZn91Oj+2Q8QOQXMnvw79SAc+pf6xS889Hv3WD39/Z8xitIQIOp+7zczzVU4v YCxhw4vLd71ubU6vBrxnu78sCOADo6xopRxq6pUJi/w21w2liUWOZ9HZaSmh8bRuyC1g 8uI82u/7m1grRCMmDPlz+FF1m1SLsGct5cPufxRVf5PYAWlymTtGxCxylcfAmYzKKv/f p+XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Hsvxt+Y8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr17-20020a170907721100b00741a251f6f7si5697149ejc.315.2022.08.31.08.40.54; Wed, 31 Aug 2022 08:41:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Hsvxt+Y8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231527AbiHaPWY (ORCPT + 99 others); Wed, 31 Aug 2022 11:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231731AbiHaPWN (ORCPT ); Wed, 31 Aug 2022 11:22:13 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5455DD8B3C; Wed, 31 Aug 2022 08:22:11 -0700 (PDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27VFG4kL029622; Wed, 31 Aug 2022 15:21:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=8lifCs+Vpucok23R/oaopnqzvPUcXxy686872IvWQRg=; b=Hsvxt+Y8oHC1HP0GTafFfOpH23ifsV61oFm1bptOaHxSIp9Tkyj0Wa/Vx8YXYt3NFMcn rK4+YVBNHQDnXtRGSjdpHOPhe/CmcHVj+XAIy29nkMpbUr2oONx2LAxhC+877oCUUQX9 pMoydvOW8R/0meWT8YabpJ/uVzilQ1I20i0QK2U3jd2oYfbKTtaOSkFi2FpoPHBpguvT ZYjJ8tjyyUkQ562D57RG8MGyz5bImCOFIen9PqKJ/vlwR5bZiQ5BPdQyCnLpjNEEg2Xj SlpXZxD0ZGf//gfVNF+ENq9/KDhq0azhXoORB3MPIQICyH0PnyfPXjFvVKptZe57nlY6 Kw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jaa4jg5uw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 31 Aug 2022 15:21:59 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27VFGpbx031663; Wed, 31 Aug 2022 15:21:58 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jaa4jg5ud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 31 Aug 2022 15:21:58 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27VFK67d018086; Wed, 31 Aug 2022 15:21:56 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06fra.de.ibm.com with ESMTP id 3j7ahhuy84-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 31 Aug 2022 15:21:56 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27VFLrLS39846274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 31 Aug 2022 15:21:53 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 458E74C04A; Wed, 31 Aug 2022 15:21:53 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C2AE4C040; Wed, 31 Aug 2022 15:21:52 +0000 (GMT) Received: from p-imbrenda (unknown [9.145.11.79]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 31 Aug 2022 15:21:52 +0000 (GMT) Date: Wed, 31 Aug 2022 17:21:51 +0200 From: Claudio Imbrenda To: Janis Schoetterl-Glausch Cc: Christian Borntraeger , Janosch Frank , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , kernel test robot , Dan Carpenter , David Hildenbrand , Sven Schnelle , kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] KVM: s390: Pass initialized arg even if unused Message-ID: <20220831172151.3e04c64c@p-imbrenda> In-Reply-To: <20220825192540.1560559-1-scgl@linux.ibm.com> References: <20220825192540.1560559-1-scgl@linux.ibm.com> Organization: IBM X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: LWcHmtMXlv8RqadyvTO4zIR9mrj7I-te X-Proofpoint-GUID: lXWEMvgH9t1hMSF6tmvW_9iJy-22h1GI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-31_09,2022-08-31_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 impostorscore=0 clxscore=1011 adultscore=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208310075 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 25 Aug 2022 21:25:40 +0200 Janis Schoetterl-Glausch wrote: > This silences smatch warnings reported by kbuild bot: > arch/s390/kvm/gaccess.c:859 guest_range_to_gpas() error: uninitialized symbol 'prot'. > arch/s390/kvm/gaccess.c:1064 access_guest_with_key() error: uninitialized symbol 'prot'. > > This is because it cannot tell that the value is not used in this case. > The trans_exc* only examine prot if code is PGM_PROTECTION. > Pass a dummy value for other codes. > > Reported-by: kernel test robot > Reported-by: Dan Carpenter > Signed-off-by: Janis Schoetterl-Glausch Reviewed-by: Claudio Imbrenda > --- > v1 -> v2 > * drop unlikely, WARN_ON_ONCE instead of WARN (thanks Heiko) > > arch/s390/kvm/gaccess.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c > index 082ec5f2c3a5..0243b6e38d36 100644 > --- a/arch/s390/kvm/gaccess.c > +++ b/arch/s390/kvm/gaccess.c > @@ -489,6 +489,8 @@ enum prot_type { > PROT_TYPE_ALC = 2, > PROT_TYPE_DAT = 3, > PROT_TYPE_IEP = 4, > + /* Dummy value for passing an initialized value when code != PGM_PROTECTION */ > + PROT_NONE, > }; > > static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar, > @@ -504,6 +506,10 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, > switch (code) { > case PGM_PROTECTION: > switch (prot) { > + case PROT_NONE: > + /* We should never get here, acts like termination */ > + WARN_ON_ONCE(1); > + break; > case PROT_TYPE_IEP: > tec->b61 = 1; > fallthrough; > @@ -968,8 +974,10 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, > return rc; > } else { > gpa = kvm_s390_real_to_abs(vcpu, ga); > - if (kvm_is_error_gpa(vcpu->kvm, gpa)) > + if (kvm_is_error_gpa(vcpu->kvm, gpa)) { > rc = PGM_ADDRESSING; > + prot = PROT_NONE; > + } > } > if (rc) > return trans_exc(vcpu, rc, ga, ar, mode, prot); > @@ -1112,8 +1120,6 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, > if (rc == PGM_PROTECTION && try_storage_prot_override) > rc = access_guest_page_with_key(vcpu->kvm, mode, gpas[idx], > data, fragment_len, PAGE_SPO_ACC); > - if (rc == PGM_PROTECTION) > - prot = PROT_TYPE_KEYC; > if (rc) > break; > len -= fragment_len; > @@ -1123,6 +1129,10 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, > if (rc > 0) { > bool terminate = (mode == GACC_STORE) && (idx > 0); > > + if (rc == PGM_PROTECTION) > + prot = PROT_TYPE_KEYC; > + else > + prot = PROT_NONE; > rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate); > } > out_unlock: