From patchwork Tue Jan 10 01:39:30 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: 13094577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A888AC54EBE for ; Tue, 10 Jan 2023 01:39:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6313F10E103; Tue, 10 Jan 2023 01:39:28 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 55B0A10E0F5; Tue, 10 Jan 2023 01:39:26 +0000 (UTC) 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 C9399B810B3; Tue, 10 Jan 2023 01:39:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57021C433D2; Tue, 10 Jan 2023 01:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673314763; bh=PT1aoEfMxbkfDZP2tvZEeoskJ4gixNERZPq/fY0PYE8=; h=Date:From:To:Cc:Subject:From; b=cznwhUoeV85DmTiZJkhZlq982DirYK7miUs1fVFvDe296SCK/1/QbIWcUqRlN4haE xe8Xt5VDPaCrrE8xJ+/w0Dtmjo4FVkxDflfpqdo1ymVWCAQ+FeOCjXJgCdAA9nPEnw PmOihzrKt41Z8jgDiHNpOyjUdB8v7exhIT34OMkY1LxlGtSz+o3tZjLMJnFMECOAiZ oXhWHISfdobmhjrJnRjSRWh1I3A0RtXrQ1j5wsYOQ+rr+9BMFXbrU9CbcbXXdkJlWZ e/WZptwcfdrCkWjn6zNWN3mpeaxqmDltXWcdfnKwavQ+JAr4qMJ/miVRkfczn6uj2U /ZcFVZB8BCyyw== Date: Mon, 9 Jan 2023 19:39:30 -0600 From: "Gustavo A. R. Silva" To: Ben Skeggs , Karol Herbst , Lyude Paul , David Airlie , Daniel Vetter Subject: [PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nouveau@lists.freedesktop.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, "Gustavo A. R. Silva" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length array declaration in struct nvfw_hs_load_header_v2 with flex-array member. 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: Kees Cook Reviewed-by: Karol Herbst --- drivers/gpu/drm/nouveau/include/nvfw/hs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/include/nvfw/hs.h b/drivers/gpu/drm/nouveau/include/nvfw/hs.h index 8c4cd08a7b5f..8b58b668fc0c 100644 --- a/drivers/gpu/drm/nouveau/include/nvfw/hs.h +++ b/drivers/gpu/drm/nouveau/include/nvfw/hs.h @@ -52,7 +52,7 @@ struct nvfw_hs_load_header_v2 { struct { u32 offset; u32 size; - } app[0]; + } app[]; }; const struct nvfw_hs_load_header_v2 *nvfw_hs_load_header_v2(struct nvkm_subdev *, const void *);