All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@linux.intel.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: intel-gfx-trybot@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/selftests: fix subtraction overflow bug
Date: Fri, 24 Jun 2022 13:52:13 +0200	[thread overview]
Message-ID: <YrWlbbAjOOSFrwln@intel.intel> (raw)
In-Reply-To: <20220624113528.2159210-1-andrzej.hajda@intel.com>

Hi Andrzej,

On Fri, Jun 24, 2022 at 01:35:28PM +0200, Andrzej Hajda wrote:
> On some machines hole_end can be small enough to cause subtraction
> overflow. On the other side (addr + 2 * min_alignment) can overflow
> in case of mock tests. This patch should handle both cases.
> 
> Fixes: e1c5f754067b59 ("drm/i915: Avoid overflow in computing pot_hole loop termination")
> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/3674
> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
> ---
>  drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> index 8633bec18fa75e..ab9f17fc85bcf2 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> @@ -742,7 +742,7 @@ static int pot_hole(struct i915_address_space *vm,
>  		u64 addr;
>  
>  		for (addr = round_up(hole_start + min_alignment, step) - min_alignment;
> -		     addr <= round_down(hole_end - (2 * min_alignment), step) - min_alignment;
> +		     hole_end > addr && hole_end - addr >= 2 * min_alignment;

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi

  reply	other threads:[~2022-06-24 11:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 11:35 [Intel-gfx] [PATCH] drm/i915/selftests: fix subtraction overflow bug Andrzej Hajda
2022-06-24 11:52 ` Andi Shyti [this message]
2022-06-24 13:23 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-06-27 19:59 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-06-30 14:33   ` Andrzej Hajda
2022-07-11 16:05 ` [Intel-gfx] [PATCH] " Andi Shyti

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=YrWlbbAjOOSFrwln@intel.intel \
    --to=andi.shyti@linux.intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx-trybot@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.