From patchwork Tue Jan 10 16:44:53 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: 41543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2855029wrt; Tue, 10 Jan 2023 08:49:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1u4FbxqSlole1ZFgGKx/cVJeoEbplf+4n8MaUWC9HdXcbm5gPiRJs34Cqk6UsG8FRwoqn X-Received: by 2002:a17:90a:bf0b:b0:226:f10a:c0de with SMTP id c11-20020a17090abf0b00b00226f10ac0demr13157532pjs.19.1673369377272; Tue, 10 Jan 2023 08:49:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673369377; cv=none; d=google.com; s=arc-20160816; b=Lwah03BQtBwjup0c8jIGV56ngpfM9KQJoGkHb3EaG1/gZ/PIIZMqDq93+SIClI+jVJ VuX8BVsWQaHClvBgmb0plJnMRvNwCWjUDWqIc+48fTLAJnWdrJr0NDhIZeWSZ45JGPT0 gzVTCWJNL8j4VHyRhXDkUZv2f0BIwmmxb8qEPs1ZvM9kHt3p3hA99vYfwHLX1AK3JQX+ Yh1DHC50dxLCKQ8Wy5S/M1Vb/cp5na5pKR/2nrAZQ+YiOBD9HY2r0XpekwyffTWLg2TR rVu2OCa9ZA0td8y7VY8C2WwGvQzCYHOq3L6i9nKlkZKIHD0fsYmSvy85IWAeBPMXxX/s kFuw== 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=S8hSpzsFlQpWMn9G5vdObzK5QUb7j4A3W7UPZKkbr4M=; b=F9axoomKXLnj6ZObGYOolCVaYb3hqOfXPp3bFgo8KzymMiEkoODLXAJHbaiGu2k38R 3uu/sr7HiW++xCDefOYgGUlM1zQPPvTw/zlz1bmsAxQBDB3HOjB1a9xFK+NJXLPjgchL bb+0PMO3tMeDpsC9Uj6ILyMX80QJIU+ghSvwDzLKW5aNmm+5d27Pb6UZGGZjFtp7tG0o EJYsmP73ZaCOYtMPVgasMSr6RdK721ER68MorZ/qj/K/5ZyQRiZNEQ3c7nbLiGzGdKUq 71MKoQzhGEQTN9C8k5ozZNiEX3SyAFteqgiXezRcz8YnpOzdO1mwrSDyYMwOExvNS+SG 5ujw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HI7JpEwk; 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 p15-20020a637f4f000000b0049699771576si12012243pgn.424.2023.01.10.08.49.24; Tue, 10 Jan 2023 08:49:37 -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=HI7JpEwk; 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 S234859AbjAJQpK (ORCPT + 99 others); Tue, 10 Jan 2023 11:45:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234356AbjAJQos (ORCPT ); Tue, 10 Jan 2023 11:44:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E575A8BA; Tue, 10 Jan 2023 08:44:47 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 0BC15617E5; Tue, 10 Jan 2023 16:44:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B925C433D2; Tue, 10 Jan 2023 16:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673369086; bh=5pn8lNPzgrol7P8MBSuD7FbH2Rhpic8YeqNAugxASls=; h=Date:From:To:Cc:Subject:From; b=HI7JpEwkuf+RJ2R7d+YsfTHRQBGCakNFWm+7b1d30HrcAcAh1p9QQmP4YXO1RXiml jR/gZjcdi/S9lCp1mHKWz9UF2qvAVC4MSw7eNLX+BkvbyA1wcr1atcLXBzCwcIoORY 6h9q2+C44XQ3YaGjgfU4qo9TQZCDFd4dXTELHiQ6v/cGxAJsqpdaidEv5Cn8CyHjiJ I9WGQy4F4ioTx1C+EhjYsc706rSMm4+I94FDxs0q/DNlBDhJSKef9pmowT1f/jCRSb pqCoJAx0aXoNfcXkf0XuF7ax9lsSySCsjp9NXhzt1zMB6KyuLS05r49mUYB5IL/PXu wcTeCnt2+yo/A== Date: Tue, 10 Jan 2023 10:44:53 -0600 From: "Gustavo A. R. Silva" To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] drm/i915/guc: Replace zero-length arrays with flexible-array members 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?1754654967682005325?= X-GMAIL-MSGID: =?utf-8?q?1754654967682005325?= Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays in a couple of structures (three, actually) with flex-array members. 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 [2]. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1] Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2] Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: Gustavo A. R. Silva Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h b/drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h index 3624abfd22d1..9d589c28f40f 100644 --- a/drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h +++ b/drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h @@ -73,7 +73,7 @@ struct guc_debug_capture_list_header { struct guc_debug_capture_list { struct guc_debug_capture_list_header header; - struct guc_mmio_reg regs[0]; + struct guc_mmio_reg regs[]; } __packed; /** @@ -125,7 +125,7 @@ struct guc_state_capture_header_t { struct guc_state_capture_t { struct guc_state_capture_header_t header; - struct guc_mmio_reg mmio_entries[0]; + struct guc_mmio_reg mmio_entries[]; } __packed; enum guc_capture_group_types { @@ -145,7 +145,7 @@ struct guc_state_capture_group_header_t { /* this is the top level structure where an error-capture dump starts */ struct guc_state_capture_group_t { struct guc_state_capture_group_header_t grp_header; - struct guc_state_capture_t capture_entries[0]; + struct guc_state_capture_t capture_entries[]; } __packed; /**