Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jonathan Cavitt" <jonathan.cavitt@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3] drm/i915/gem: Explicitly return error value from eb_relocate helpers
Date: Thu, 03 Dec 2026 18:08:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-248341@kernel.org> (raw)
In-Reply-To: <20261203165741.2928732-1-jonathan.cavitt@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/i915/gem: stale remain = -EFAULT in eb_relocate_vma()
--

commit 6d5dcf84817706043cd50b98c302e38dfccdf3a7
Author: Jonathan Cavitt <jonathan.cavitt@intel.com>

drm/i915/gem: Explicitly return error value from eb_relocate helpers

This commit changes relocate_entry() and eb_relocate_entry() to return an
int error code and pass the offset back through a u64 pointer argument.
It updates eb_relocate_vma() and eb_relocate_vma_slow() to check the
returned error directly instead of casting the offset to a signed type.

> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index c41e1b9a40bca..d3272bf17bb04 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c

[ ... ]

> @@ -1599,12 +1602,13 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
>  				remain = -EFAULT;
>  				goto out;
>  			}
> +			err = 0;
>  		} while (r++, --count);
>  		urelocs += ARRAY_SIZE(stack);
>  	} while (remain);
>  out:
>  	reloc_cache_reset(&eb->reloc_cache, eb);
> -	return remain;
> +	return err;
>  }

[Severity: Low]
Should remain = -EFAULT be updated now that the out label returns err
instead of remain?

Even though the put_user() error check is disabled with && 0, assigning
-EFAULT to unsigned long remain is now a dead store and leaves the
disabled error path inconsistent with the rest of eb_relocate_vma().

Reusing the outer err for put_user() also forces the manual err = 0 reset
so a put_user() failure does not leak out of the loop.  Keeping a separate
local variable for put_user() and setting err = -EFAULT in the disabled
branch would avoid both.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203165741.2928732-1-jonathan.cavitt@intel.com?part=1

  reply	other threads:[~2026-12-03 18:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 16:57 [PATCH v3] drm/i915/gem: Explicitly return error value from eb_relocate helpers Jonathan Cavitt
2026-12-03 18:08 ` sashiko-bot [this message]
2026-12-03 18:41 ` ✓ i915.CI.BAT: success for drm/i915/gem: Explicitly return error value from eb_relocate helpers (rev4) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-248341@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jonathan.cavitt@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox