From: "Ville Syrjälä" <ville.syrjala@linux.intel.com> To: Chris Wilson <chris@chris-wilson.co.uk> Cc: intel-gfx@lists.freedesktop.org, stable@vger.kernel.org Subject: Re: [Intel-gfx] [PATCH] drm/i915/gem: Detect overflow in calculating dumb buffer size Date: Thu, 23 Jan 2020 15:27:07 +0200 [thread overview] Message-ID: <20200123132707.GK13686@intel.com> (raw) In-Reply-To: <20200123125934.1401755-1-chris@chris-wilson.co.uk> On Thu, Jan 23, 2020 at 12:59:34PM +0000, Chris Wilson wrote: > To multiply 2 u32 numbers to generate a u64 in C requires a bit of > forewarning for the compiler. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Ramalingam C <ramalingam.c@intel.com> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > Cc: stable@vger.kernel.org > --- > drivers/gpu/drm/i915/i915_gem.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 0a20083321a3..ff79da5657f8 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -265,7 +265,10 @@ i915_gem_dumb_create(struct drm_file *file, > DRM_FORMAT_MOD_LINEAR)) > args->pitch = ALIGN(args->pitch, 4096); > > - args->size = args->pitch * args->height; > + if (args->pitch < args->width) > + return -EINVAL; > + > + args->size = mul_u32_u32(args->pitch, args->height); I thought something would have checked these against the mode_config fb limits already. But can't see code like that anywhere. Maybe we should just do that in the core? > > mem_type = INTEL_MEMORY_SYSTEM; > if (HAS_LMEM(to_i915(dev))) > -- > 2.25.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Ville Syrjälä Intel
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com> To: Chris Wilson <chris@chris-wilson.co.uk> Cc: intel-gfx@lists.freedesktop.org, stable@vger.kernel.org Subject: Re: [Intel-gfx] [PATCH] drm/i915/gem: Detect overflow in calculating dumb buffer size Date: Thu, 23 Jan 2020 15:27:07 +0200 [thread overview] Message-ID: <20200123132707.GK13686@intel.com> (raw) In-Reply-To: <20200123125934.1401755-1-chris@chris-wilson.co.uk> On Thu, Jan 23, 2020 at 12:59:34PM +0000, Chris Wilson wrote: > To multiply 2 u32 numbers to generate a u64 in C requires a bit of > forewarning for the compiler. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Ramalingam C <ramalingam.c@intel.com> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > Cc: stable@vger.kernel.org > --- > drivers/gpu/drm/i915/i915_gem.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 0a20083321a3..ff79da5657f8 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -265,7 +265,10 @@ i915_gem_dumb_create(struct drm_file *file, > DRM_FORMAT_MOD_LINEAR)) > args->pitch = ALIGN(args->pitch, 4096); > > - args->size = args->pitch * args->height; > + if (args->pitch < args->width) > + return -EINVAL; > + > + args->size = mul_u32_u32(args->pitch, args->height); I thought something would have checked these against the mode_config fb limits already. But can't see code like that anywhere. Maybe we should just do that in the core? > > mem_type = INTEL_MEMORY_SYSTEM; > if (HAS_LMEM(to_i915(dev))) > -- > 2.25.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-01-23 13:27 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-23 12:59 [PATCH] drm/i915/gem: Detect overflow in calculating dumb buffer size Chris Wilson 2020-01-23 12:59 ` [Intel-gfx] " Chris Wilson 2020-01-23 13:27 ` Ville Syrjälä [this message] 2020-01-23 13:27 ` Ville Syrjälä 2020-01-23 13:39 ` Chris Wilson 2020-01-23 13:39 ` Chris Wilson 2020-01-23 13:58 ` Ville Syrjälä 2020-01-23 13:58 ` Ville Syrjälä 2020-01-23 21:33 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork 2020-01-25 11:55 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20200123132707.GK13686@intel.com \ --to=ville.syrjala@linux.intel.com \ --cc=chris@chris-wilson.co.uk \ --cc=intel-gfx@lists.freedesktop.org \ --cc=stable@vger.kernel.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: linkBe 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.