[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250709-flex-array-check-v1-0-8adeb0bf0cde@imgtec.com>
Date: Wed, 9 Jul 2025 11:04:08 +0100
From: Matt Coster <matt.coster@...tec.com>
To: Frank Binns <frank.binns@...tec.com>,
Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>
CC: <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
"Matt
Coster" <matt.coster@...tec.com>
Subject: [PATCH 0/2] drm/imagination: Fixes for flexible structures
These fixes were made as part of investigating the Sparse issue reported
in [1]; specifically that the sizeof() check for the flexible structure
struct rogue_fwif_frag_ctx_state was failing under Sparse.
This is actually a fairly pointless check, and the discrepancy is
related to the implicit padding at the end of the structure that is
never used due to the flexible array member. A far more useful check is
to assert that the final member is indeed a flexible array as expected,
and that one element of said array is of the size that we expect.
While fixing that, I stumbled on the useful struct_size_t() macro and
put it to good use wherever the size of the structure in question is
computed.
[1]: https://lore.kernel.org/r/20250606-sprase-reasoning-comments-v1-1-433c0ff11a09@imgtec.com
Signed-off-by: Matt Coster <matt.coster@...tec.com>
---
Matt Coster (2):
drm/imagination: Add and use FLEX_ARRAY_CHECK()
drm/imagination: Use struct_size_t()
drivers/gpu/drm/imagination/pvr_queue.c | 11 +++++------
drivers/gpu/drm/imagination/pvr_rogue_fwif_check.h | 19 ++++++++++++++++++-
2 files changed, 23 insertions(+), 7 deletions(-)
---
base-commit: fe88fb3421161f3abd974ee2ecbe2d9195f98812
change-id: 20250704-flex-array-check-ac9c3b6f130e
Powered by blists - more mailing lists