[PATCH] drm/xe: Fix coverity issue, overflow_assign

Matthew Auld matthew.auld at intel.com
Mon Aug 4 13:50:45 UTC 2025


On 04/08/2025 14:45, Pravalika Gurram wrote:
> Safe cast of error code from long to int
> 
> Fixes: cda06412c0689 ("drm/xe: Wait for migration job before unmapping pages")
> 
> Signed-off-by: Pravalika Gurram <pravalika.gurram at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_bo.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index 1a72561f987c..a1e82c879f1e 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -988,7 +988,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
>   						     false,
>   						     MAX_SCHEDULE_TIMEOUT);
>   		if (timeout < 0)
> -			ret = timeout;
> +			ret = (int)timeout;

On this error path it should only contain some standard error code which 
will easily fit inside an int. I have at least seen this pattern plenty 
of times elsewhere, even outside of xe, so this seems more like a false 
positive?

>   
>   		if (IS_VF_CCS_BB_VALID(xe, bo))
>   			xe_sriov_vf_ccs_detach_bo(bo);



More information about the Intel-xe mailing list