Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Avoid divide by zero
Date: Tue, 22 Jan 2019 21:09:25 +0200	[thread overview]
Message-ID: <20190122190925.GZ20097@intel.com> (raw)
In-Reply-To: <87y37cef8b.fsf@intel.com>

On Tue, Jan 22, 2019 at 08:09:40PM +0200, Jani Nikula wrote:
> On Tue, 22 Jan 2019, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > On Tue, Jan 22, 2019 at 02:58:24PM +0200, Mika Kahola wrote:
> >> Avoid divide by zero warning on static analysis.
> >> 
> >> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/intel_pm.c | 6 ++++--
> >>  1 file changed, 4 insertions(+), 2 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> >> index 8b63afa3a221..6a8e8b3f44c2 100644
> >> --- a/drivers/gpu/drm/i915/intel_pm.c
> >> +++ b/drivers/gpu/drm/i915/intel_pm.c
> >> @@ -3912,8 +3912,10 @@ skl_ddb_get_pipe_allocation_limits(struct drm_i915_private *dev_priv,
> >>  			pipe_width = hdisplay;
> >>  	}
> >>  
> >> -	alloc->start = ddb_size * width_before_pipe / total_width;
> >> -	alloc->end = ddb_size * (width_before_pipe + pipe_width) / total_width;
> >> +	alloc->start = total_width == 0 ?
> >> +		0 : ddb_size * width_before_pipe / total_width;
> >> +	alloc->end = total_width == 0 ?
> >> +		0 : ddb_size * (width_before_pipe + pipe_width) / total_width;
> >
> > Can't happen.
> 
> Yeah, it's about stfu the checker...

Feels like the tip of an iceberg. How many more uglies are we going to
have to add?

> 
> >
> >>  }
> >>  
> >>  static unsigned int skl_cursor_allocation(int num_active)
> >> -- 
> >> 2.17.1
> >> 
> >> _______________________________________________
> >> Intel-gfx mailing list
> >> Intel-gfx@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-01-22 19:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 12:58 [PATCH] drm/i915: Avoid divide by zero Mika Kahola
2019-01-22 13:07 ` Jani Nikula
2019-01-22 13:22   ` Kahola, Mika
2019-01-22 16:00 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-01-22 16:23 ` [PATCH] " Ville Syrjälä
2019-01-22 18:09   ` Jani Nikula
2019-01-22 19:09     ` Ville Syrjälä [this message]
2019-01-23  7:21       ` Kahola, Mika
2019-01-23 18:32         ` Ville Syrjälä
2019-01-22 19:36 ` ✓ Fi.CI.IGT: success 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=20190122190925.GZ20097@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox