Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maíra Canal" <mcanal@igalia.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 6/6] drm/vc4: Use drm_timeout_rel_to_jiffies()
Date: Mon, 17 Aug 2026 21:15:48 +0000	[thread overview]
Message-ID: <20260817211548.6A3551F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260817-drm-timeout-helpers-v2-6-73052b669f49@igalia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Incomplete Fix / Unhandled 32-bit Overflow in `vc4_wait_for_seqno`
--

--- Patch [6]: [PATCH v2 6/6] drm/vc4: Use drm_timeout_rel_to_jiffies() ---
commit 4c26550a287cbb245dc4be4698ea36a63eca121d
Author: Maíra Canal <mcanal@igalia.com>

drm/vc4: Use drm_timeout_rel_to_jiffies()

This patch updates vc4_wait_bo_ioctl() to use drm_timeout_rel_to_jiffies()
instead of usecs_to_jiffies(). This prevents long timeout values from
wrapping around into much shorter timeouts due to unsigned int narrowing.

> diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> index e231c906709c1..781aeb8967b15 100644
> --- a/drivers/gpu/drm/vc4/vc4_gem.c
> +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> @@ -970,7 +971,7 @@ vc4_wait_bo_ioctl(struct drm_device *dev, void *data,
>  	int ret;
>  	struct drm_vc4_wait_bo *args = data;
>  	unsigned long timeout_jiffies =
> -		usecs_to_jiffies(div_u64(args->timeout_ns, 1000));
> +		drm_timeout_rel_to_jiffies(args->timeout_ns);

[Severity: High]
This isn't a bug introduced by this patch, but I noticed that
vc4_wait_for_seqno() also appears to need a similar fix.

Could this lead to immediate early expiration on 32-bit systems for large
timeout values?

It calculates timeout_expire using nsecs_to_jiffies() without clamping to
MAX_JIFFY_OFFSET:

drivers/gpu/drm/vc4/vc4_gem.c:vc4_wait_for_seqno() {
    ...
	if (timeout_ns == 0)
		return -ETIME;

	timeout_expire = jiffies + nsecs_to_jiffies(timeout_ns);
    ...
}

If the resulting jiffies offset exceeds MAX_JIFFY_OFFSET, adding it to jiffies
would result in a value that time_after_eq() evaluates as being in the past,
causing the wait loop to exit immediately with -ETIME.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260817-drm-timeout-helpers-v2-0-73052b669f49@igalia.com?part=6

  reply	other threads:[~2026-08-17 21:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 21:05 [PATCH v2 0/6] drm: Consolidate the wait timeout conversion helpers Maíra Canal
2026-08-17 21:05 ` [PATCH v2 1/6] drm: Move drm_timeout_abs_to_jiffies() to drm_timeout.c Maíra Canal
2026-08-20  6:37   ` Thomas Zimmermann
2026-08-20  6:50   ` Thomas Zimmermann
2026-08-17 21:05 ` [PATCH v2 2/6] drm: Add drm_timeout_rel_to_jiffies() Maíra Canal
2026-08-17 21:15   ` sashiko-bot
2026-08-20  6:54   ` Thomas Zimmermann
2026-08-17 21:05 ` [PATCH v2 3/6] drm/amdgpu: Use drm_timeout_abs_to_jiffies() Maíra Canal
2026-08-17 21:05 ` [PATCH v2 4/6] drm/v3d: Use drm_timeout_rel_to_jiffies() Maíra Canal
2026-08-17 21:05 ` [PATCH v2 5/6] drm/i915: " Maíra Canal
2026-08-17 21:05 ` [PATCH v2 6/6] drm/vc4: " Maíra Canal
2026-08-17 21:15   ` sashiko-bot [this message]
2026-08-17 21:55 ` ✓ i915.CI.BAT: success for drm: Consolidate the wait timeout conversion helpers (rev2) Patchwork
2026-08-18 11:43 ` ✓ i915.CI.Full: " 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=20260817211548.6A3551F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mcanal@igalia.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