diff options
| author | Matt Coster <matt.coster@imgtec.com> | 2025-07-09 11:04:10 +0100 |
|---|---|---|
| committer | Alessio Belle <alessio.belle@imgtec.com> | 2026-07-20 14:25:01 +0100 |
| commit | b67ac31d7f42b2b2e9ca77c66bbbb3646f039103 (patch) | |
| tree | 1b163029da7065ebbb6504eb49d37291c90b931f /drivers/gpu/drm/imagination | |
| parent | f41ef8e3c65f1c424004493f7792ce06daa147df (diff) | |
| download | linux-next-b67ac31d7f42b2b2e9ca77c66bbbb3646f039103.tar.gz linux-next-b67ac31d7f42b2b2e9ca77c66bbbb3646f039103.zip | |
drm/imagination: Use struct_size_t()
The helpers for dealing with flexible structures exist, so let's use them.
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Alessio Belle <alessio.belle@imgtec.com>
Link: https://patch.msgid.link/20250709-flex-array-check-v1-2-8adeb0bf0cde@imgtec.com
Signed-off-by: Alessio Belle <alessio.belle@imgtec.com>
Diffstat (limited to 'drivers/gpu/drm/imagination')
| -rw-r--r-- | drivers/gpu/drm/imagination/pvr_queue.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c index 941c017399fc..54e88b4208d7 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -3,6 +3,7 @@ #include <drm/drm_managed.h> #include <drm/gpu_scheduler.h> +#include <linux/overflow.h> #include "pvr_cccb.h" #include "pvr_context.h" @@ -36,9 +37,8 @@ static int get_xfer_ctx_state_size(struct pvr_device *pvr_dev) return err; } - return sizeof(struct rogue_fwif_frag_ctx_state) + - (num_isp_store_registers * - sizeof(((struct rogue_fwif_frag_ctx_state *)0)->frag_reg_isp_store[0])); + return struct_size_t(struct rogue_fwif_frag_ctx_state, + frag_reg_isp_store, num_isp_store_registers); } static int get_frag_ctx_state_size(struct pvr_device *pvr_dev) @@ -66,9 +66,8 @@ static int get_frag_ctx_state_size(struct pvr_device *pvr_dev) return err; } - return sizeof(struct rogue_fwif_frag_ctx_state) + - (num_isp_store_registers * - sizeof(((struct rogue_fwif_frag_ctx_state *)0)->frag_reg_isp_store[0])); + return struct_size_t(struct rogue_fwif_frag_ctx_state, + frag_reg_isp_store, num_isp_store_registers); } static int get_ctx_state_size(struct pvr_device *pvr_dev, enum drm_pvr_job_type type) |
