Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4681250rwd; Tue, 23 May 2023 10:53:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4idIAxmjRZQCPgwSw4U+PPFfOgPsnaiNNNUSy93WLQ0X3O4Nv2Ooz1wzf3GhUSmfpAf7c8 X-Received: by 2002:a05:6a00:1596:b0:63b:8778:99e4 with SMTP id u22-20020a056a00159600b0063b877899e4mr19930318pfk.2.1684864399331; Tue, 23 May 2023 10:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684864399; cv=none; d=google.com; s=arc-20160816; b=tU2sIEZuUN2MuOnuSdr8sPIey/QEBm2xgpRQ1zWgQE0bBMnstDw2nWxoXz1vdaZnpp dli9nSjQZSPOIT3f6Z+0wY8XxRx0owcOMrhKBlEdlKMPgQhqPWN8b5Lug358BsbTiiTQ 25xDfQ0P7zn3hjcX8DVfbUdZcuV6IHvR2ZmW4NCgVMfUUn2MHElpNBJvR+coizXjQhjU dbG6ODlXvWYqf0nXIM+6dp6fENtg9y/W9oe7IIL44tnbcrOJAtKPjaQIw1YuwFwS20cj k1YeqAIQAOLtvrZvABgmSLAY5TZ0k9OwSPxPb9C62jy5XXI7g3ZI29cnuY0ni2DGvSnG zZ8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6+vEzETCBUbqlh1LZrUq3iscDKbAGRNMMe5Z1TEFaUA=; b=skZ92tslUxMicJnLj5iowI1bMZCDmorDjt1aRS09ynqJ+vqMBhAd7mgiOUBbBZE7WP aiZZ+bucjnsVEHUH0mcOKsAuFp8R8cGE9gxphrknBGez5hFBY084oO+Z/Cej3jJrQwWt 749+xjjKnFbF6JFc3zWY0NF4ffCf0lOhw9s5Bu01F4XdZgMh4wntrM2bHEpvyZsOpEeW BJD8bd0oHLbF7UKAnKPmaVZo0TlApDyp2ccl6MHLWImcJ6ys1OMhf5fib7GKqMyjv/oH v4N2iZ3yThS2xRPIrUpSPkQMUfsvYgh+EjDuTM43wk/re+K4LuoOtFVVo+UF9B8HNec6 f3jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=GMAwEpWk; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 193-20020a6218ca000000b006467de1cbc8si78266pfy.226.2023.05.23.10.53.05; Tue, 23 May 2023 10:53:19 -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=@wanadoo.fr header.s=t20230301 header.b=GMAwEpWk; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238139AbjEWRp5 (ORCPT + 99 others); Tue, 23 May 2023 13:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237978AbjEWRpl (ORCPT ); Tue, 23 May 2023 13:45:41 -0400 Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0899710DA for ; Tue, 23 May 2023 10:45:27 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 1W4UqPsLO8SAU1W4UqtSil; Tue, 23 May 2023 19:45:19 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684863919; bh=6+vEzETCBUbqlh1LZrUq3iscDKbAGRNMMe5Z1TEFaUA=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=GMAwEpWkBjSvQeerMp4Irxwjp9ZtaXEwb196Z+fF3X/ErHcEzDX0EkZsPkf2/vxc6 KNAIrx+1kiuqC5dchulERoi3z98pTebsRrwp0U67RaOxsvmR10mjWq1A8bg3T5E9DK +u18Swc6+IPUooc7vJqy8jxQmQQUOS4EBrxf2qNsTsSsNnBivgvXb6bJGzQrsKxB6z +/O7zGLLEnZyWnbjBO/8nnG+a8lFgSQ1FkCQrs/51UJrHKZP9Q0Qv/To78heWX4y9U O1q0u092cyEb7dB7nwhCEpctSrl11ORSvzN7MOLoh0+Swy75PZA8cFAm/Xlhtkx1ol IX4lgafGL16Yg== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 23 May 2023 19:45:19 +0200 X-ME-IP: 86.243.2.178 Message-ID: Date: Tue, 23 May 2023 19:45:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 1/2][next] vfio/ccw: Replace one-element array with flexible-array member Content-Language: fr, en-US To: "Gustavo A. R. Silva" , 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, linux-hardening@vger.kernel.org References: <3c10549ebe1564eade68a2515bde233527376971.1684805398.git.gustavoars@kernel.org> From: Christophe JAILLET In-Reply-To: <3c10549ebe1564eade68a2515bde233527376971.1684805398.git.gustavoars@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 Le 23/05/2023 à 03:35, Gustavo A. R. Silva a écrit : > One-element arrays are deprecated, and we are replacing them with flexible > array members instead. So, replace one-element array with flexible-array > member in struct vfio_ccw_parent and refactor the the rest of the code > accordingly. > > Link: https://github.com/KSPP/linux/issues/79 > Link: https://github.com/KSPP/linux/issues/297 > Signed-off-by: Gustavo A. R. Silva > --- > drivers/s390/cio/vfio_ccw_drv.c | 3 ++- > drivers/s390/cio/vfio_ccw_private.h | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c > index ff538a086fc7..57906a9c6324 100644 > --- a/drivers/s390/cio/vfio_ccw_drv.c > +++ b/drivers/s390/cio/vfio_ccw_drv.c > @@ -171,7 +171,8 @@ static int vfio_ccw_sch_probe(struct subchannel *sch) > return -ENODEV; > } > > - parent = kzalloc(sizeof(*parent), GFP_KERNEL); > + parent = kzalloc(sizeof(*parent) + sizeof(struct mdev_type *), Hi, wouldn't: parent = kzalloc(struct_size(parent, mdev_types, 1)), be more informative and in the spirit of flexible array use? Just my 2c, CJ > + GFP_KERNEL); > if (!parent) > return -ENOMEM; > > diff --git a/drivers/s390/cio/vfio_ccw_private.h b/drivers/s390/cio/vfio_ccw_private.h > index b441ae6700fd..b62bbc5c6376 100644 > --- a/drivers/s390/cio/vfio_ccw_private.h > +++ b/drivers/s390/cio/vfio_ccw_private.h > @@ -79,7 +79,7 @@ struct vfio_ccw_parent { > > struct mdev_parent parent; > struct mdev_type mdev_type; > - struct mdev_type *mdev_types[1]; > + struct mdev_type *mdev_types[]; > }; > > /**