[RESEND] drm/nouveau/fb/ga102: Replace zero-length array of trailing structs with flex-array
Message ID | 20230103234835.never.378-kees@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4873054wrt; Tue, 3 Jan 2023 15:49:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXvR75um37FFLFz2R/Sh+noKTBnj9ep4e2SqITi5vmwxvftO2cbpL3/BXU4+HxeRNPrKqgsJ X-Received: by 2002:a17:906:859:b0:84c:c4a4:61ca with SMTP id f25-20020a170906085900b0084cc4a461camr8523233ejd.61.1672789798693; Tue, 03 Jan 2023 15:49:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672789798; cv=none; d=google.com; s=arc-20160816; b=cqUPoh6lwwAaW+216cZNjd0uRopi93QYqhSX8OpkiQ9aD+dNsjVdEmki5q/l2iWDN0 Harn0YzTAIVQXhTgkeYMoqJevpmlCR/zg9wXsx78ZFH+Y1UvxUb0YTpSdncqwSuYgp0v SDbsnbWiw7qwUQ9ugJdw+UQhmIl53LMf95D4WaIJhLlJScE0jvgzlLLOB2bb7lSnesKp iQonfOFnVSQQZ4h6v2S2NFDBCeGfBBfz8j3j+E0OiuL1/3bJgei7yWOjvXlSc/vT4WY4 vXV2mj6ZH3uzWRdJcqXALx7tohZNB8j6xT+N79I50lpJrZn71iezNjHo4y999TvTOJvZ iEOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kDnfWPh2h9/FS+QZS/MSOgsNnMP44C24NODsrzRFUuM=; b=DAJJXXS95WH7uco3jNfZG7oUVpHCjx6m9YHHV4NebgfRp9TUzR1lpc+LymsmntRCLL x/oOVTgYn2J0ge1TTnt3HYtdkSelnjcfiGbIQORYEwfIlKWPbuuzW84MdQaPfAFSwYhi BFCru1EGi9YgorHUeO+gDVBPPYAfKm20v6iISyIjNRxusL576IoEEaCa74xDgt7mTcwb +4bx2KXr/wm9gOrYnW5A3IU+PBrfLe0pBMyj8LwtHEutDUoIs0gJVoCpmxw5pLrPHM9u bXqm39ByigFuNT5HUlF/fq2HA7YHIRWB0lm2yrL+0AYBgpREWIfUcalgLkMbfRz39J3c hohQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JZ8UC9FM; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a17090699c400b0084c439a1d98si22805304ejn.454.2023.01.03.15.49.35; Tue, 03 Jan 2023 15:49:58 -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=@chromium.org header.s=google header.b=JZ8UC9FM; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234222AbjACXs4 (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Tue, 3 Jan 2023 18:48:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234109AbjACXsn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 3 Jan 2023 18:48:43 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB5510045 for <linux-kernel@vger.kernel.org>; Tue, 3 Jan 2023 15:48:39 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id 17so34349120pll.0 for <linux-kernel@vger.kernel.org>; Tue, 03 Jan 2023 15:48:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kDnfWPh2h9/FS+QZS/MSOgsNnMP44C24NODsrzRFUuM=; b=JZ8UC9FMNChsjAjclGrQ6PEw9HlE0aeBAxKyAg+tRtQ71C1VRJ9l24kwhapJ7z+l0K QAVCJW+NtLO9X/viSTN5RnZV/oz8FFoCixVq1PpSxuniK7kmSWvjcy3oe0GiXLg0WJq9 54x6qhh/PtzWp3DntyqNr3zplvC2uTHtSQIAg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kDnfWPh2h9/FS+QZS/MSOgsNnMP44C24NODsrzRFUuM=; b=XO06SKd7/XSU4kZw18wJot+Bh9ydIf1r9gN8iNTPZuvBXLpvO41e++6KQj79Y9hOX0 8rtFdU/zCLXCikBTCeKk5S+7bxag+fXEoo5jBoZZGCq6vU727UrwoeuH7i0Zh3hV0a2N 63KVWWv1qKa4jKO3Jbqp/dNyeLrL4Ro1OiWoPw8VhR8VCvZ7NsKQIThzk3nR5Qr9A2Pr ItF2qWBTYxoWb7hwTyZO29bEHHuPgtmoNIolEZ063CR27VCDZ8rLNseEdwPahelhrb9m PbdHwUX1khwp9qqD3m2fDFaax/8e8xktbDR249/AinJlNOhSsDkqC1xJ0wB1x4cXp/i4 /Bsg== X-Gm-Message-State: AFqh2krEnfemiw0p6TbAFkz+J+iTgDRUJLg35sZiLWjj+5IhXCT+S0gV Oj/8PqMyIPrHo1lzjmCuZXr5PQ== X-Received: by 2002:a17:90b:1bc2:b0:212:daa7:590 with SMTP id oa2-20020a17090b1bc200b00212daa70590mr64679889pjb.7.1672789719104; Tue, 03 Jan 2023 15:48:39 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id c21-20020a17090aa61500b00219463262desm19148364pjq.39.2023.01.03.15.48.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 15:48:38 -0800 (PST) From: Kees Cook <keescook@chromium.org> To: Ben Skeggs <bskeggs@redhat.com> Cc: Kees Cook <keescook@chromium.org>, Karol Herbst <kherbst@redhat.com>, Lyude Paul <lyude@redhat.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Gourav Samaiya <gsamaiya@nvidia.com>, "Gustavo A. R. Silva" <gustavoars@kernel.org>, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [RESEND][PATCH] drm/nouveau/fb/ga102: Replace zero-length array of trailing structs with flex-array Date: Tue, 3 Jan 2023 15:48:36 -0800 Message-Id: <20230103234835.never.378-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1514; h=from:subject:message-id; bh=yNDAQz5L/StW+b14k9XOZhzSrABBg07i4qvrOt4rnsQ=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBjtL7UV5oPZ4aSWc790jMdrk79oP2SuDFrhpYN3dAV U45tjoCJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCY7S+1AAKCRCJcvTf3G3AJjfoD/ 9eZAMC/zIpdWOvrTeGfrphFv3DowrWpQpy2/jYIqQfGi7/r2Yp9ZLfiIgpABUIQFOEBtxRI6DBYzhn j2Jnr9dC8QT94UIJBjmGYn3FGybpbB9n0xlQs+FvSs+RF9gvvOqA8Eue8I+8S5KCW5gjQOB3zOXP30 A82/LDSd9t6zwmSrjqJ/bDzpZ5W1zZxLIBlE+lkIoo4olaSzK2DQ6Kn78aGPoICV2Rs6a4kduTTT+/ CYX/w+1ba6iK7n/cA0x8z8HNR6BPGBhedyeSQsU0PkxyYKBnJ7+lOeRozCD0mtCrCvCIB8ZCZ3xUov 85+IMnp6earP8cWAh0GGqEJUlZ/R2OaiB7eLG4QqsMZQfcoFe6s6VJUiqqf2F+qI3NjgzfB4aIfFEx zXVZdNH04Mpb/k0nl/PtHO2Uj42hp9eenr6zjMPDBsQl4oMUn6nemlkNrfw6pnJncakLLH00TjFkCY ObgbCLGQDpYqt1sNj3Ogv1CDBgNtNAgXyOfLVbwKxUr/widlNwnCPLvMdGkW+vhkg6mpiFdA9Bzo6Y 3lYANl81UelN34Y7TmyIWAEYr6Hr1XMKAUuubdA3tlCoQLPP0sXfgFv5S3Z3fAeRp4tRqLAMDVJVKW RIHhb0ND8kYXODJQU314xcLTgpvXoaSamYHoUlD6hP8snaFkWc9XRjhuWaMg== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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?1754047235648270290?= X-GMAIL-MSGID: =?utf-8?q?1754047235648270290?= |
Series |
[RESEND] drm/nouveau/fb/ga102: Replace zero-length array of trailing structs with flex-array
|
|
Commit Message
Kees Cook
Jan. 3, 2023, 11:48 p.m. UTC
Zero-length arrays are deprecated[1] and are being replaced with
flexible array members in support of the ongoing efforts to tighten the
FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing
with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3.
Replace zero-length array with flexible-array member.
This results in no differences in binary output.
[1] https://github.com/KSPP/linux/issues/78
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Gourav Samaiya <gsamaiya@nvidia.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Sent before as: https://lore.kernel.org/all/20221118211207.never.039-kees@kernel.org/
---
drivers/gpu/drm/nouveau/include/nvfw/hs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Jan 03, 2023 at 03:48:36PM -0800, Kees Cook wrote: > Zero-length arrays are deprecated[1] and are being replaced with > flexible array members in support of the ongoing efforts to tighten the > FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing > with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3. > > Replace zero-length array with flexible-array member. > > This results in no differences in binary output. > > [1] https://github.com/KSPP/linux/issues/78 > > Cc: Ben Skeggs <bskeggs@redhat.com> > Cc: Karol Herbst <kherbst@redhat.com> > Cc: Lyude Paul <lyude@redhat.com> > Cc: David Airlie <airlied@gmail.com> > Cc: Daniel Vetter <daniel@ffwll.ch> > Cc: Gourav Samaiya <gsamaiya@nvidia.com> > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Cc: dri-devel@lists.freedesktop.org > Cc: nouveau@lists.freedesktop.org > Signed-off-by: Kees Cook <keescook@chromium.org> Here is my RB again: Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Thanks! -- Gustavo > --- > Sent before as: https://lore.kernel.org/all/20221118211207.never.039-kees@kernel.org/ > --- > 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 *); > -- > 2.34.1 >
On Wed, Jan 4, 2023 at 1:52 AM Gustavo A. R. Silva <gustavoars@kernel.org> wrote: > > On Tue, Jan 03, 2023 at 03:48:36PM -0800, Kees Cook wrote: > > Zero-length arrays are deprecated[1] and are being replaced with > > flexible array members in support of the ongoing efforts to tighten the > > FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing > > with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3. > > > > Replace zero-length array with flexible-array member. > > > > This results in no differences in binary output. > > > > [1] https://github.com/KSPP/linux/issues/78 > > > > Cc: Ben Skeggs <bskeggs@redhat.com> > > Cc: Karol Herbst <kherbst@redhat.com> > > Cc: Lyude Paul <lyude@redhat.com> > > Cc: David Airlie <airlied@gmail.com> > > Cc: Daniel Vetter <daniel@ffwll.ch> > > Cc: Gourav Samaiya <gsamaiya@nvidia.com> > > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > > Cc: dri-devel@lists.freedesktop.org > > Cc: nouveau@lists.freedesktop.org > > Signed-off-by: Kees Cook <keescook@chromium.org> > > Here is my RB again: > > Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> > Reviewed-by: Karol Herbst <kherbst@redhat.com> will push in a moment > Thanks! > -- > Gustavo > > > --- > > Sent before as: https://lore.kernel.org/all/20221118211207.never.039-kees@kernel.org/ > > --- > > 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 *); > > -- > > 2.34.1 > > >
On Mon, Jan 16, 2023 at 5:24 PM Karol Herbst <kherbst@redhat.com> wrote: > > On Wed, Jan 4, 2023 at 1:52 AM Gustavo A. R. Silva > <gustavoars@kernel.org> wrote: > > > > On Tue, Jan 03, 2023 at 03:48:36PM -0800, Kees Cook wrote: > > > Zero-length arrays are deprecated[1] and are being replaced with > > > flexible array members in support of the ongoing efforts to tighten the > > > FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing > > > with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3. > > > > > > Replace zero-length array with flexible-array member. > > > > > > This results in no differences in binary output. > > > > > > [1] https://github.com/KSPP/linux/issues/78 > > > > > > Cc: Ben Skeggs <bskeggs@redhat.com> > > > Cc: Karol Herbst <kherbst@redhat.com> > > > Cc: Lyude Paul <lyude@redhat.com> > > > Cc: David Airlie <airlied@gmail.com> > > > Cc: Daniel Vetter <daniel@ffwll.ch> > > > Cc: Gourav Samaiya <gsamaiya@nvidia.com> > > > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > > > Cc: dri-devel@lists.freedesktop.org > > > Cc: nouveau@lists.freedesktop.org > > > Signed-off-by: Kees Cook <keescook@chromium.org> > > > > Here is my RB again: > > > > Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> > > > > Reviewed-by: Karol Herbst <kherbst@redhat.com> > > will push in a moment > just noticed it's the same change than the other one... anyway, will push the oldest one > > Thanks! > > -- > > Gustavo > > > > > --- > > > Sent before as: https://lore.kernel.org/all/20221118211207.never.039-kees@kernel.org/ > > > --- > > > 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 *); > > > -- > > > 2.34.1 > > > > >
Hi! Sorry for the late response, I've had my head buried in some regressions from AMD for a while now and am now just catching up on my email. Does this still need to be pushed upstream? On Tue, 2023-01-03 at 18:52 -0600, Gustavo A. R. Silva wrote: > On Tue, Jan 03, 2023 at 03:48:36PM -0800, Kees Cook wrote: > > Zero-length arrays are deprecated[1] and are being replaced with > > flexible array members in support of the ongoing efforts to tighten the > > FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing > > with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3. > > > > Replace zero-length array with flexible-array member. > > > > This results in no differences in binary output. > > > > [1] https://github.com/KSPP/linux/issues/78 > > > > Cc: Ben Skeggs <bskeggs@redhat.com> > > Cc: Karol Herbst <kherbst@redhat.com> > > Cc: Lyude Paul <lyude@redhat.com> > > Cc: David Airlie <airlied@gmail.com> > > Cc: Daniel Vetter <daniel@ffwll.ch> > > Cc: Gourav Samaiya <gsamaiya@nvidia.com> > > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > > Cc: dri-devel@lists.freedesktop.org > > Cc: nouveau@lists.freedesktop.org > > Signed-off-by: Kees Cook <keescook@chromium.org> > > Here is my RB again: > > Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> > > Thanks! > -- > Gustavo > > > --- > > Sent before as: https://lore.kernel.org/all/20221118211207.never.039-kees@kernel.org/ > > --- > > 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 *); > > -- > > 2.34.1 > > >
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 *);