[PATCH] drm/xe: Fix coverity issue, overflow_assign
Matthew Brost
matthew.brost at intel.com
Tue Aug 5 03:31:09 UTC 2025
On Mon, Aug 04, 2025 at 02:50:45PM +0100, Matthew Auld wrote:
> 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?
>
I agree with Matt Auld, timeout here is going to be -ERESTARTSYS in the
failure case. Seems like a false positive.
Matt
> > if (IS_VF_CCS_BB_VALID(xe, bo))
> > xe_sriov_vf_ccs_detach_bo(bo);
>
More information about the Intel-xe
mailing list