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: 41247 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2487787wrt; Mon, 9 Jan 2023 17:40:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXsbHfwMQDcj95Cewk12cT04lnFDqoiKN8JvsTGBwSK/9AW6uC++hbltjomp4SKevsmg1oVI X-Received: by 2002:a05:6a20:d044:b0:b0:32f0:6237 with SMTP id hv4-20020a056a20d04400b000b032f06237mr81209509pzb.18.1673314859081; Mon, 09 Jan 2023 17:40:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673314859; cv=none; d=google.com; s=arc-20160816; b=x9LANaw+wi8bKumO8dkANXLhq76haF/QrDTletZ3aWg5JLuyT7eS2uPaYKi3ayl6Nu agsZV1WRjEGvjoa3hh8Nqwk3jKwZMjvPHWw+7mOV2M7H4eCk0ML56zB67HqrFN5mDE8F gTzD5hi05fhf2TPGlL07LIuXIaWgYAfuLqxx3U6G6YL7ZuvxjTm5zM68FQW8fafEj/95 zsqp0BV9+6+PCGa16VcW4VkL6b1uVT4nIKkzmy2cdPYIR0YeNxlRqyNsEJVpS0YunZal h+nKxwaNRb+eYjf0v9bwXqCsYQHXjxE4TLZW27ciewcJW+aBU4nkcCqQjWm7lfBo70Un nlZA== 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=Ed+bT+y/BsrnJedQpLYWbpSUt5Nh+BJiJppyJlU+Cco=; b=KDuck4O3eer6ugVMZeMEfEbM9G+/UY6e+vWkaq55yuUYKDQlmQ56BsLdBT6vnq+TuW vCkREnu0ftf+3GGvOuKkhTZ/1gEbiVZ5na2JCZJ6Mt5Luo+NZXZwYRq0fxUHlStw3lar PVcK+SeILPZhTRSlLpi5kEk8ttQu6fCH626Ek3oZ/jWCeylkm4iaBQIVZgBK1c45c+/4 HaXtb5kjFmvnaOscWQWX38E8XtMrbNk69MfKYFRw8Y1egKXBhIN4y/8mnRqHwGxRJXdr eM0CsS49ThTnYMGhuoR7bKZIs4WVDGGEv0wFsaNaDSPPO6a5K10OeFWSAZzRRWJTZc/Q iYzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cznwhUoe; 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 b7-20020a656687000000b004789f4ef8a6si10466803pgw.640.2023.01.09.17.40.45; Mon, 09 Jan 2023 17:40:59 -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=cznwhUoe; 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 S229820AbjAJBj3 (ORCPT + 99 others); Mon, 9 Jan 2023 20:39:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbjAJBj0 (ORCPT ); Mon, 9 Jan 2023 20:39:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9EFCA1B3; Mon, 9 Jan 2023 17:39:24 -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 4D785614B1; 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 Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] drm/nouveau/nvkm: Replace zero-length 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?1754597801842472839?= X-GMAIL-MSGID: =?utf-8?q?1754597801842472839?= 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 *);