Re: [PATCH v5 5/6] drm/xe/vf: Add bounds checking for queried VRAM size

Michal Wajdeczko <[email protected]>
Newsgroups org.freedesktop.lists.intel-xe
Message-ID <[email protected]>

On 8/10/2026 12:14 PM, Satyanarayana K V P wrote:
> Add explicit bounds checks for VRAM size which can detect and reject
> invalid configuration data from a misconfigured or malfunctioning PF,
> preventing protocol violations and protecting VF initialization.
> 
> Signed-off-by: Satyanarayana K V P <[email protected]>
> Cc: Michal Wajdeczko <[email protected]>
> ---
> V4 -> V5:
> - New commit.
> ---
>  drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> index 65e48f135801..6c1878e4b1b2 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> @@ -575,7 +575,7 @@ static int vf_get_lmem_info(struct xe_gt *gt)
>  		return err;
>  
>  	lmem_size = xe_tile_sriov_vf_lmem(tile);
> -	if (lmem_size && lmem_size != size) {
> +	if ((lmem_size && lmem_size != size) || (size % SZ_2M)) {

IS_ALIGNED(size, SZ_2M)

and since those are two different conditions, they deserve different
error codes and different message (-EREMCHG for reassignment and
-EPROTO or maybe better -EINVAL if unaligned)
>  		xe_gt_sriov_err(gt, "Unexpected LMEM reassignment: %lluM != %lluM\n",
>  				size / SZ_1M, lmem_size / SZ_1M);
>  		return -EREMCHG;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.