From patchwork Fri Feb 3 01:27:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 52255 Return-Path: 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 + 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 ); 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" To: Zack Rusin , VMware Graphics Reviewers , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] drm/vmwgfx: Replace one-element array with flexible-array member Message-ID: MIME-Version: 1.0 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: 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?= 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 Reviewed-by: Kees Cook Reviewed-by: Zack Rusin --- 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);