All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/display: Avoid divide by zero
Date: Thu, 21 Aug 2025 16:05:07 +0300	[thread overview]
Message-ID: <aKcZg9tk2YH0r67f@intel.com> (raw)
In-Reply-To: <20250820132913.496505-1-juhapekka.heikkila@gmail.com>

On Wed, Aug 20, 2025 at 04:29:13PM +0300, Juha-Pekka Heikkila wrote:
> skl_crtc_allocate_plane_ddb allow iter.data_rate to be zero
> which could cause divide by zero in skl_allocate_plane_ddb,
> check against that.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
>  drivers/gpu/drm/i915/display/skl_watermark.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c
> index def5150231a4..403783504ab3 100644
> --- a/drivers/gpu/drm/i915/display/skl_watermark.c
> +++ b/drivers/gpu/drm/i915/display/skl_watermark.c
> @@ -1388,7 +1388,7 @@ skl_allocate_plane_ddb(struct skl_plane_ddb_iter *iter,
>  {
>  	u16 size, extra = 0;
>  
> -	if (data_rate) {
> +	if (data_rate && iter->data_rate) {

I don't think it should be possible to have iter_data->data_rate==0 
and data_rate!=0, with iter->data_rate being the sum of all the
planes' data_rates.

>  		extra = min_t(u16, iter->size,
>  			      DIV64_U64_ROUND_UP(iter->size * data_rate,
>  						 iter->data_rate));
> -- 
> 2.43.0

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2025-08-21 13:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 13:29 [PATCH] drm/i915/display: Avoid divide by zero Juha-Pekka Heikkila
2025-08-20 19:02 ` ✓ CI.KUnit: success for " Patchwork
2025-08-20 20:04 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-08-21  4:19 ` [PATCH] " Kandpal, Suraj
2025-08-21  8:01 ` ✓ i915.CI.BAT: success for " Patchwork
2025-08-21  9:55 ` ✗ i915.CI.Full: failure " Patchwork
2025-08-21 13:05 ` Ville Syrjälä [this message]
2025-08-26  9:21   ` [PATCH] " Juha-Pekka Heikkilä
2025-08-21 19:24 ` ✗ Xe.CI.Full: failure for " 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=aKcZg9tk2YH0r67f@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.com \
    /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.