Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3990990iog; Tue, 28 Jun 2022 07:00:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vVIMY8heaOMloXMjBeEVO5kx1KFeHrLtodN9ZselxUlEwKUpnQ/A7E2FrEk55f27/nk8NB X-Received: by 2002:a05:6a00:2488:b0:525:97c2:d9de with SMTP id c8-20020a056a00248800b0052597c2d9demr3829829pfv.43.1656424826143; Tue, 28 Jun 2022 07:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656424826; cv=none; d=google.com; s=arc-20160816; b=mbTIqaf0vQNfeKLUa/URIL3piXXahVyq0any/TDQlq0nJn1b2oS8QKmby0OOrxSrCD q/NfPuZonrsKAA0YEkVtHjEQA/WRBKJDNfIdzy8fjupTBrFJN5F1dr2sn6q4db9SbDZO ziED/18uWFOapcw4SUEG1XLwnvAF73arcZAC6FuBxZlaH/tuhdiWYZpSPHQa0whT/Jco qpAQkpyfIJipxL+D87c/2YAqy3zM8n8Gr0fUmBsZhjf7BHnCqpjBkF+R4sFwyi5rBzm8 jDSFYDO6DBAz7lCPhI6jrcKZIsiOfY3ZuySlEAf30BgHsfLLqEEG9/pR94Ik1u1MeJKB zRxA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HNG0pvMhGgxFerG2GWrJAfenLfiSwl0sPYL3hqEYyQ0=; b=xgsohloUiwNXJJCEFCpqC3X30hDOQsVFkexoPS0XIjkSmXzBPGtK2u8MNN4ZoeJF23 mY0QZUh5PfJs8Qi9s/cyGSo9F5BZEjJzT51u0jhD3FTntPglfOJrVgjr/elE200ROPzz vyOOaeQ9QInvxnjOCcqDd4f5cAvXBEgT5SaNeID9n7/EJl6w/KW/2pAVzfIfp+Zdrm4c dPqbXHXJEcHfhbq1oD0zf9Se1xqYLS8enChA2DII+mKaHbeYfMLixHQ/v9ho49fOopAB 58uioVnDI/jheRsL53/K2MC9rZ7PZ0eFeYgOfYqMEwT++YE9lmcOSkM9zpNKpb5C63MG R/FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=HsddZcmS; 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 az14-20020a17090b028e00b001e4dd12a09esi17537150pjb.39.2022.06.28.07.00.11; Tue, 28 Jun 2022 07:00:26 -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=HsddZcmS; 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 S1345950AbiF1N6o (ORCPT + 99 others); Tue, 28 Jun 2022 09:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345982AbiF1N4d (ORCPT ); Tue, 28 Jun 2022 09:56:33 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CF2F338A6; Tue, 28 Jun 2022 06:56:32 -0700 (PDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25SDlD1T020642; Tue, 28 Jun 2022 13:56:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=HNG0pvMhGgxFerG2GWrJAfenLfiSwl0sPYL3hqEYyQ0=; b=HsddZcmSvIDZPdFoGMQMIZU9ZSdRC2SxYlC2t5gov9M3o13VtdgnHxbxjCxz/Zohh9JP 8TE+AjuWIjGC+XxsLscKiG/R5XzN1iSSwCDUE2bjKDdmPvvPcKEyB02mnUPv3/f5cJrO 9iBAa61kMl7YRDJEuT4a9VaJSaYuj9SBF6KFrxoQje7teWSGNnvQFdS3e4sFoCvuJtmp 4YGBzpBuhLq7pJM09ZSD31zp09TOGlMQ755GM/qH4meEw45Rc3Ft0KO9hd5rVTwC7nNK 6xaWzi+wehou+s/kngryq+JEDYVfxm2NPlYTHPOL7NhYSDjsG7eI5EfY8KRxs8j2nA0l iw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3h02u7rayd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jun 2022 13:56:31 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 25SDlZEP022226; Tue, 28 Jun 2022 13:56:30 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3h02u7ravq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jun 2022 13:56:27 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25SDoutf007874; Tue, 28 Jun 2022 13:56:26 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 3gwt08vxru-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jun 2022 13:56:26 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25SDuNbA17236422 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 13:56:23 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0CBB94C040; Tue, 28 Jun 2022 13:56:23 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E22F4C044; Tue, 28 Jun 2022 13:56:22 +0000 (GMT) Received: from p-imbrenda.boeblingen.de.ibm.com (unknown [9.152.224.40]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 28 Jun 2022 13:56:22 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, pasic@linux.ibm.com, david@redhat.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, scgl@linux.ibm.com, mimu@linux.ibm.com, nrb@linux.ibm.com Subject: [PATCH v12 07/18] KVM: s390: pv: clear the state without memset Date: Tue, 28 Jun 2022 15:56:08 +0200 Message-Id: <20220628135619.32410-8-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628135619.32410-1-imbrenda@linux.ibm.com> References: <20220628135619.32410-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: xp2nWcsrAq2MQ3keFh0sx2bxDyPoIp-t X-Proofpoint-ORIG-GUID: WN4HzELgJRloQgWlQS7t94zAHfEdRI2_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-28_07,2022-06-28_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=800 phishscore=0 impostorscore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280057 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 Do not use memset to clean the whole struct kvm_s390_pv; instead, explicitly clear the fields that need to be cleared. Upcoming patches will introduce new fields in the struct kvm_s390_pv that will not need to be cleared. Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank --- arch/s390/kvm/pv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/s390/kvm/pv.c b/arch/s390/kvm/pv.c index f3134d79f8e1..9eca80afedce 100644 --- a/arch/s390/kvm/pv.c +++ b/arch/s390/kvm/pv.c @@ -16,6 +16,14 @@ #include #include "kvm-s390.h" +static void kvm_s390_clear_pv_state(struct kvm *kvm) +{ + kvm->arch.pv.handle = 0; + kvm->arch.pv.guest_len = 0; + kvm->arch.pv.stor_base = 0; + kvm->arch.pv.stor_var = NULL; +} + int kvm_s390_pv_destroy_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc) { int cc; @@ -110,7 +118,7 @@ static void kvm_s390_pv_dealloc_vm(struct kvm *kvm) vfree(kvm->arch.pv.stor_var); free_pages(kvm->arch.pv.stor_base, get_order(uv_info.guest_base_stor_len)); - memset(&kvm->arch.pv, 0, sizeof(kvm->arch.pv)); + kvm_s390_clear_pv_state(kvm); } static int kvm_s390_pv_alloc_vm(struct kvm *kvm) -- 2.36.1