Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1014706pxb; Fri, 15 Apr 2022 18:24:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzd2N/B4a6RieN3W7gB67wJxrglpjkQfoe1Fs2qKs7jAKMUuFlo4eiUFmq0PDykSZIPq01s X-Received: by 2002:a17:902:da8b:b0:158:cd1e:b4c3 with SMTP id j11-20020a170902da8b00b00158cd1eb4c3mr1589418plx.121.1650072260049; Fri, 15 Apr 2022 18:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650072260; cv=none; d=google.com; s=arc-20160816; b=Q3IoJLRW2/eG7NihTSow3ZSbW/Uq5pbgIopX9DyKFGW3G6E8e1jhpXSGwhn7pvLcwk OfvWlq7I6ksEHpoL9xV+AQ6Fsy1DPszjEUZF1DCQ8RY2DwlrDYrMrI0IJNXcd00poSsA mkOATsE0Y+K/dgCEyHG5CLAKTpXAh1BoaRQjierjWWn8lmjZp3AYoP1EJhBGsSFBftAq pRstVojf5KzA3JXxvHEZbu/4D/J20jIr1RBqHmoj8QPsK9GHQ6VcYA0vLouuoBVg+Gc8 2ckhwdbQyfTjq1Eg7upSoyrcHfh9oGGGUGrxXkHkdtRKuiI6d1Ey7Uj9Ldkz4MSvv/+Y F3fw== 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=L+8PjHPMiq4AQHcRLajykYL0EPB3iNidhaOlepmKopc=; b=lxU1f8FtROIHhegy6TCt2/i+hm+s+c/pyvxmynA4CSjpqwd6PvAnPZB0Uku7BUk02V KsScvi1xzXietrUKKyGUCb5qLqPZ7Vl5kcUpMAScgVjqN5rDljPOnR0yfnsbLA4zd8gO U7SZ3BIsffvZ964N9n6m2Dp6RhHeCUUMsPQel1+V2Hy5eDiRNSDhK2E+bMsXT6l4mBle fTPbgUdHIWWNjmRX1almarQkd8bAOMbgvk6zqE/qipe+OhTzbbKpKyV8hBvI0Jx5X2pn qo+G2wLYnJ/lUTGEFerEYj/y9SH3mzZobMrG5lH4AuPDOK8739PPufhWWqUS4yo3mLk3 iKlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=RhU1Fh0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q18-20020a170902c75200b00153f163b3c6si2325260plq.552.2022.04.15.18.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=RhU1Fh0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D1B95113D30; Fri, 15 Apr 2022 17:55:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240949AbiDNIGn (ORCPT + 99 others); Thu, 14 Apr 2022 04:06:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240755AbiDNIFw (ORCPT ); Thu, 14 Apr 2022 04:05:52 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC0474D617; Thu, 14 Apr 2022 01:03:28 -0700 (PDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23E4seL5025433; Thu, 14 Apr 2022 08:03:28 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=L+8PjHPMiq4AQHcRLajykYL0EPB3iNidhaOlepmKopc=; b=RhU1Fh0VkILmuNeXW3h70dkQjqCK3KXStRrqR9TjAVAYhqQmUWo+j7ZLIHj0Dpv8LCb1 GtWA7zHJJKyfowskF0Y4WQp88p2jxrV6jBc1BGXiLy234qupBH3GByT1he0dm8PzFo1A zLRciVCQ/p5M+dIEvbBBglslZJJCHzkIEmcvnV1yMqYs0ON7GnZJkB29KcC6GUz3jNFl hysdqI+/3E+lK8HryI+waZvGLP+i3zCliAKSl8X7MfKOMcjGJ/soEJgeKj+mUPb9bu7z KpYpHXNgik+IMgb1mMxDdl1LAuCMLJHSZKJV5u72apaGUouWfkt30gjJ6BT6vD1q3nPB 9w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fed0kk9wu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Apr 2022 08:03:28 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 23E7xaBX002307; Thu, 14 Apr 2022 08:03:27 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fed0kk9w7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Apr 2022 08:03:27 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23E7mA0O006046; Thu, 14 Apr 2022 08:03:25 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 3fb1s8yy6m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Apr 2022 08:03:25 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23E83Mqf32637314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Apr 2022 08:03:22 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 384A8AE056; Thu, 14 Apr 2022 08:03:22 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC4F2AE04D; Thu, 14 Apr 2022 08:03:21 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.1.140]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Apr 2022 08:03:21 +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 v10 08/19] KVM: s390: pv: clear the state without memset Date: Thu, 14 Apr 2022 10:02:59 +0200 Message-Id: <20220414080311.1084834-9-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220414080311.1084834-1-imbrenda@linux.ibm.com> References: <20220414080311.1084834-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: MJ_dyZ6cd46YTlxMBm3QqBG6lCfxLyyd X-Proofpoint-GUID: xD1JcWtSKXCAOzItd4-GR5IoJZSDDriG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-14_01,2022-04-13_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 bulkscore=0 clxscore=1015 mlxlogscore=872 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204140040 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 9e900ce7387d..76ef33a277d3 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.34.1