Message ID | Y9xi7nFWRV3S9gCg@work |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp580774wrn; Thu, 2 Feb 2023 17:34:17 -0800 (PST) X-Google-Smtp-Source: AK7set9miv5II0nPLkpkewfEz0qXDaeQmdqy6J8ABRgZQUwID8r2sbL3UFEcpjG5879LpaOmiT/H X-Received: by 2002:a05:6402:5516:b0:4a2:564f:4c33 with SMTP id fi22-20020a056402551600b004a2564f4c33mr8388565edb.37.1675388057497; Thu, 02 Feb 2023 17:34:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675388057; cv=none; d=google.com; s=arc-20160816; b=jIjATt/RCq7eaGvLjjM1kDmjb0MTnFiSwOLwBs4WJ91oKI5K7qzqPNGVSOqdW2uRKM Iml3orvtMCIiY6k+1MyBlphyPuSriILNxeXbgrBQPxuYcsOAu0wJAUknDtQckuCu30i/ 1vw0go7bDYwii0NN8PGW0EpxcaMYGt7DjVKjE77Pxj9hUGRt/d1aPkJLikTZXngPZBIX cpraQ6P/1UCxbOhI34u98gfPkuxu/LlNLUpmkTRmcvqN5vNghniwpYw44Oc+sOSPK+Uy Nydh2o3Q6zMPpPJwE3dU6H/OzyxKe/ahZUa5T3lD+9+iqVL0PNnCidpSudq0pz0f6ar5 /ZVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=rYZTSE0dPwlFHvzEwCB1j+LCOesDA2aGtcJfxCU9JSM=; b=0hS3yEfL4BsZzcUeoH9ZmtbmglrEnjcCon18UiNEZBewaZeoYWpqvpvXSHq46bbgrI MYdepWqFidKuSWCCVc8bdjgHCa8KMJdvLSwUwO4TtyeLLucGRZunFxmUbHEysL/Cl7fL hFX5W2S0BOR/NKCfwYSPBJ+SBDJLkMCUPfgN1NNdf4uhQSRlhM6L6JA7NBPdFdkfkJU9 QrGNBZWjFSKSqFg0YzGmk8P4pYCGujN0qEkNhLhJHTP9t7TFx/TGgSTuK9mLfzEpifC9 fUsjimihCXCLg/GBL14SReVDjPsAFR4kcXte7/hcQfS5nwwj/b5dUCOND1jkEOVN3f/p xvig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="fgjB/OX/"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a17090674c100b0087b6bbbcfc9si1637721ejl.373.2023.02.02.17.33.53; Thu, 02 Feb 2023 17:34:17 -0800 (PST) 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="fgjB/OX/"; 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 S230432AbjBCB1A (ORCPT <rfc822;il.mystafa@gmail.com> + 99 others); Thu, 2 Feb 2023 20:27:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbjBCB06 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 2 Feb 2023 20:26:58 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7226E12070; Thu, 2 Feb 2023 17:26:57 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 1D52EB828E3; Fri, 3 Feb 2023 01:26:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABA63C433D2; Fri, 3 Feb 2023 01:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675387614; bh=BeDxNw/tbCXEvqvBC4QZZK3yzQcUhswiYl5f9/R3DnU=; h=Date:From:To:Cc:Subject:From; b=fgjB/OX/yNDmVt8S9/mAB1WYIfH8CuP9RCrtSbH3soSX4Kuz2IJ9bbMmLxxNalu4S DtdEgK36CFsj58PLna91BETx2B5TO4eJ6od4DJC2r5cxMQJ9G8DUEjjHtSSU1CpVql /FfRN8XVncaUoqHOYNJss3kfPAFP8RXEXHFkNf2oRwyi0YspICLPJhFn8m97hr6fgH Nb+48MtQKRxTRrU+SVb1M4GBqfClIq+UNBWj9YFpj7fQ03W0CM60Rp3/1OsmiQUuT2 Ar03yAWEbnWMNlnm3HgiY2Sz2HD1ImFMxOtKe1O1PZPiNVdaco9hTp0/Kr3ot4sloI dWPogeww9QBXQ== Date: Thu, 2 Feb 2023 19:27:10 -0600 From: "Gustavo A. R. Silva" <gustavoars@kernel.org> To: Zack Rusin <zackr@vmware.com>, VMware Graphics Reviewers <linux-graphics-maintainer@vmware.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" <gustavoars@kernel.org>, linux-hardening@vger.kernel.org Subject: [PATCH][next] drm/vmwgfx: Replace one-element array with flexible-array member Message-ID: <Y9xi7nFWRV3S9gCg@work> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756771707580553229?= X-GMAIL-MSGID: =?utf-8?q?1756771707580553229?= |
Series |
[next] drm/vmwgfx: Replace one-element array with flexible-array member
|
|
Commit Message
Gustavo A. R. Silva
Feb. 3, 2023, 1:27 a.m. UTC
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 vmw_view.
This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].
This results in no differences in binary output.
Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/254
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_so.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, Feb 02, 2023 at 07:27:10PM -0600, Gustavo A. R. Silva wrote: > 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 vmw_view. > > This helps with the ongoing efforts to tighten the FORTIFY_SOURCE > routines on memcpy() and help us make progress towards globally > enabling -fstrict-flex-arrays=3 [1]. > > This results in no differences in binary output. > > Link: https://github.com/KSPP/linux/issues/79 > Link: https://github.com/KSPP/linux/issues/254 > Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org>
On Thu, 2023-02-02 at 19:27 -0600, Gustavo A. R. Silva wrote: > 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 vmw_view. > > This helps with the ongoing efforts to tighten the FORTIFY_SOURCE > routines on memcpy() and help us make progress towards globally > enabling -fstrict-flex-arrays=3 [1]. > > This results in no differences in binary output. > > Link: > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKSPP%2Flinux%2Fissues%2F79&data=05%7C01%7Czackr%40vmware.com%7Ca3eb026ab82f44e3b1d708db0585bd84%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638109844250628429%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=I7IzZMu692BHi68sJFTfSonR4OYW1Kd5D6CENIizrsw%3D&reserved=0 > Link: > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FKSPP%2Flinux%2Fissues%2F254&data=05%7C01%7Czackr%40vmware.com%7Ca3eb026ab82f44e3b1d708db0585bd84%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638109844250628429%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Hk97x3i6xHOrq09iuDYojySU9H8ulvlArzGXoKrEDtU%3D&reserved=0 > Link: > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgcc.gnu.org%2Fpipermail%2Fgcc-patches%2F2022-October%2F602902.html&data=05%7C01%7Czackr%40vmware.com%7Ca3eb026ab82f44e3b1d708db0585bd84%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638109844250628429%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2B3QRmhuEvEOem89Do6hpS3%2B5sFDcuS%2BWWh9yv6triog%3D&reserved=0 > [1] > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> > --- > drivers/gpu/drm/vmwgfx/vmwgfx_so.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_so.c > b/drivers/gpu/drm/vmwgfx/vmwgfx_so.c > index 4ea32b01efc0..0f696ccaddc6 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_so.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_so.c > @@ -70,7 +70,7 @@ struct vmw_view { > unsigned view_id; /* Immutable */ > u32 cmd_size; /* Immutable */ > bool committed; /* Protected by binding_mutex */ > - u32 cmd[1]; /* Immutable */ > + u32 cmd[]; /* Immutable */ > }; > > static int vmw_view_create(struct vmw_resource *res); Reviewed-by: Zack Rusin <zackr@vmware.com> Will this go in through linux-next directly or do you want me to push it through drm-misc-next? z
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_so.c b/drivers/gpu/drm/vmwgfx/vmwgfx_so.c index 4ea32b01efc0..0f696ccaddc6 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_so.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_so.c @@ -70,7 +70,7 @@ struct vmw_view { unsigned view_id; /* Immutable */ u32 cmd_size; /* Immutable */ bool committed; /* Protected by binding_mutex */ - u32 cmd[1]; /* Immutable */ + u32 cmd[]; /* Immutable */ }; static int vmw_view_create(struct vmw_resource *res);