Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3683783rwd; Mon, 22 May 2023 18:46:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6mDN+2fY9YCxU+OFU9dNOdVR+zF1NLPKt6vPoaHqbQ22CHURC7HohJqnEgEN12pokx9faK X-Received: by 2002:a05:6a20:54a4:b0:10b:2203:6ab1 with SMTP id i36-20020a056a2054a400b0010b22036ab1mr6784157pzk.4.1684806376088; Mon, 22 May 2023 18:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684806376; cv=none; d=google.com; s=arc-20160816; b=mz3FdGUUTqEsvx5ONhqwJIBzt2egYP0W38jGmRXuObtoQyMtxFVCNKMS4w/zo9/UxJ mfycb0N4UASHCaccqonr2hJbGii6ugvzz989mTk1MTgdVfDxMZ1i1q9Qd3vDUs0238Q3 PC+SSz7K0Or+waa1Do/OdyC+3N0eSVfpqZaUUJihrM+XNFk37q5F6MGDrU4hzwQrqdCd 3rNhcHpuFkVeIZ6X71yVWGoG78bgymScLo86uvHa6aZ7EIGK9VvVjsDpqigqPH0bIYua xHYNLszEjVLY6xCSW8gk5G5K3HsLXWRCrs4miYifWx3B4fg7wauAQ3lNJnOeNnvnNume DwWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AplVz93lcTalJBHn/l7UjRKD2sXe9TPnYxfUWAmBSCo=; b=rjVdidG6ZhdIpx/+vNjVDOyt/soM6xFAOWyOLfUwl+NVDMhXDwHR/sggHn0wEL6u/1 m81VTM3SNKthofkB2WMdo3Y64smJIRSYNgjYTuxXAscL1KXgG0KafbaC+Ut8ON4Gri3D jtejPtcC0lMYYHBGu4E+uCMbvlX0VfNhKohG/HwF2mAIaw+P4pLvAwbSNcFNsqg1HjgB AHqSmBJ1zfEnKKW0Sa3kBHutrLekfnxqBpiQxFKpxmfN+zgXYTc1icryymYyIitCMgMy dHHtp14hIvU/259gSAp78WopxFeTGVHcIBDKiiEzhMZcnViGfoBqxr0LVTEAkUKdCzRS CP2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qKNIA0kd; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020aa79828000000b00648019bae38si1265752pfl.277.2023.05.22.18.46.03; Mon, 22 May 2023 18:46:16 -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=@kernel.org header.s=k20201202 header.b=qKNIA0kd; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233597AbjEWBff (ORCPT + 99 others); Mon, 22 May 2023 21:35:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235097AbjEWBfJ (ORCPT ); Mon, 22 May 2023 21:35:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC75E9E; Mon, 22 May 2023 18:35:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2493162D90; Tue, 23 May 2023 01:35:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDDFFC433D2; Tue, 23 May 2023 01:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684805707; bh=ZVMZMDyY6PGeWLHzzzIJkAPjAJ4vdQOwm8Dt6MaAg4s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qKNIA0kdKj7tAvK2gRaXubxah2TuEOe4R60oz9LFjX5XtltGDbZh/dElX5UrODlWQ 96ti7dPfXUF5sBC6KfECWZLqEVHvqIOha3ZjDDE5qxy6zyLybP80e9Kh+PSOQr4Bbr 2s3vbccXWZ8VxznWOUzBsOznhssnAerPySzO5+a+ca9n29gvCR0vkoTaSOiLMACwE+ pgRpSmESYc559R8moYJ2qtlDgboB/EkoXI7qElZwEi9sDX8cyMcM/BwS2J8FU8QtdR XiJ7uYl+B9my4O5b0LCRRlCtKVGMBfZoCj7GNfNPW4TiLDsIJwTS69P8QgKWe1SLmL UoD4+02u+dQhA== Date: Mon, 22 May 2023 19:35:59 -0600 From: "Gustavo A. R. Silva" To: Eric Farman , Matthew Rosato , Halil Pasic , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle Cc: linux-s390@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH 2/2][next] vfio/ccw: Use struct_size() helper Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 Prefer struct_size() over open-coded versions. Link: https://github.com/KSPP/linux/issues/160 Signed-off-by: Gustavo A. R. Silva --- drivers/s390/cio/vfio_ccw_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c index 57906a9c6324..43601816ea4e 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -171,8 +171,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch) return -ENODEV; } - parent = kzalloc(sizeof(*parent) + sizeof(struct mdev_type *), - GFP_KERNEL); + parent = kzalloc(struct_size(parent, mdev_types, 1), GFP_KERNEL); if (!parent) return -ENOMEM; -- 2.34.1