lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7c2dcc953227e79bdabb4c7e4d071907c5ae643b.camel@imgtec.com>
Date: Tue, 15 Jul 2025 16:28:57 +0000
From: Alessio Belle <Alessio.Belle@...tec.com>
To: Matt Coster <Matt.Coster@...tec.com>
CC: "tzimmermann@...e.de" <tzimmermann@...e.de>,
        "simona@...ll.ch"
	<simona@...ll.ch>,
        "dri-devel@...ts.freedesktop.org"
	<dri-devel@...ts.freedesktop.org>,
        "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>,
        Frank Binns <Frank.Binns@...tec.com>,
        "maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>,
        "mripard@...nel.org" <mripard@...nel.org>,
        "airlied@...il.com"
	<airlied@...il.com>
Subject: Re: [PATCH 2/2] drm/imagination: Use struct_size_t()

On Wed, 2025-07-09 at 11:04 +0100, Matt Coster wrote:
> The helpers for dealing with flexible structures exist, so let's use them.
> 
> Signed-off-by: Matt Coster <matt.coster@...tec.com>

Reviewed-by: Alessio Belle <alessio.belle@...tec.com>

Thanks,
Alessio

> ---
>  drivers/gpu/drm/imagination/pvr_queue.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c
> index 5a41ee79fed646a86344cd16e78efdb45ff02e43..094a854576a5a63f56e56acdebf01bdf542ae4d5 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"
> @@ -35,9 +36,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)
> @@ -65,9 +65,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)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ