Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp290209pxm; Wed, 2 Mar 2022 15:34:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmD/bdogmbpXEJSR44CStR3l4LBleQgIS26ckRS3IJnXMoXLo6vatu2ym4aFlHNmsMJ2Bc X-Received: by 2002:a65:5842:0:b0:374:58b8:2563 with SMTP id s2-20020a655842000000b0037458b82563mr27908038pgr.52.1646264043763; Wed, 02 Mar 2022 15:34:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646264043; cv=none; d=google.com; s=arc-20160816; b=rq0Mc6knsCvWKqLSIA+Ik3LVBVW0xjIspWvU+IC0H4fLTtqFWs0ayYPLxwx8nttUnh uDNMVV0T6pHPouGy2Yjk+6bNvB/KFnqXBg65cFUOjDVkNKRQJaNR2hl40HTTYS6GrFjA wLhifcSDXkLngqeIe3LvcdUDzn+5bIAJhd9b1E+mOuWPmvHYkG5NvwuJ0dY91tgyI2KJ ubO9RAtz+owUiReqffO6CWJ7rusnD2jpoC6m9ZOyqbiPIintHHp2uEDR9lrqHbJ/sPNx ZBa87sCdS4uu12DaQQ73G3viP74bgmwg6niUwxP+Ri83f56HlBbeOpK5kOSgA5ftgjoy d18g== 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=OH5mWM4SGV6iTsQTJnJgSZmXyzdhO9tC7foEcJmeSqj1zP3SN/dF/o7FpkKhFFpYp8 t9mWxZPWpf5bDnqeMHhv2nfz3s+Aow2v0N0/OIwodlD/FJPHTYgBQt7GUFzM931jcC12 JWeu5bnGnRbnZuvIYkOOSEm4xRdtKYfvPOVzs7ENrbyHGu1kXVtqos0mExg+v5o+rqzV CZPWSyxZtypoBuyrJv5/9Uf4xpyKi/0JQC4ZRmxGRVonoqBjwRGi4QPZxJXTJ14IC31O VG9sNrIHpmAfmJUYtbkqtAX9IZHILWEw6h4UM2n6R4tjD8XSW3CwZL/zwB2e2OLu2yXZ 0Zfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=VJuJ1bg+; 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 y6-20020a636406000000b0036c3e99b627si404097pgb.552.2022.03.02.15.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 15:34:03 -0800 (PST) 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=VJuJ1bg+; 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B0CA5151370; Wed, 2 Mar 2022 15:03:24 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244482AbiCBSN0 (ORCPT + 99 others); Wed, 2 Mar 2022 13:13:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244464AbiCBSMk (ORCPT ); Wed, 2 Mar 2022 13:12:40 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F210D2244; Wed, 2 Mar 2022 10:11:55 -0800 (PST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 222Hlcax031865; Wed, 2 Mar 2022 18:11:54 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=VJuJ1bg+JaekwoSNMhMqqIa7m/0Tag8jYtELxtX8ZwBzEP1LmhES6JNHGSjWJ1q1x2on VvXxKH4SXT+smTE9RdQ8DaDKYwOrHLlSonNWwreeCS0y+LTIg95+jmehwTZUIVk9im+n 4hb5B6AcXwnCajwNPNU/1f6EZtMD1SlswJoleb3rzrbOrCt8f7ePdJB4I5Y+QVxTKx6Z jS93cMyh1VUi/swSPHXS1IWiBSRU+bQLDF/M4m3L+Rz2smnV6ldlIfDJms3LtSJVeT38 lcSgFOWk2WnotjJXfH+O7aRvDWOnfZ+KQTp+BbxHKXht/WqVmY293GQ3Iv+t98DsldQt EQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ejd9wgg6x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Mar 2022 18:11:54 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 222HvYiU009402; Wed, 2 Mar 2022 18:11:54 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ejd9wgg6a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Mar 2022 18:11:53 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 222I8qDd022892; Wed, 2 Mar 2022 18:11:52 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 3efbu9e1mc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Mar 2022 18:11:52 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 222IBnV657213208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Mar 2022 18:11:49 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E8E945204E; Wed, 2 Mar 2022 18:11:48 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.5.37]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6D66852054; Wed, 2 Mar 2022 18:11:48 +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 v8 08/17] KVM: s390: pv: clear the state without memset Date: Wed, 2 Mar 2022 19:11:34 +0100 Message-Id: <20220302181143.188283-9-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220302181143.188283-1-imbrenda@linux.ibm.com> References: <20220302181143.188283-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: h73KnlUUAp0MTOLbmmSyWapsHUCHJp6T X-Proofpoint-GUID: 7H-NlKJhJwctHms70wtoVTwBEbDfijay X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-02_12,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 clxscore=1015 bulkscore=0 malwarescore=0 suspectscore=0 impostorscore=0 adultscore=0 mlxlogscore=810 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2203020078 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