From: Dan Carpenter <dan.carpenter@oracle.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
dri-devel@lists.freedesktop.org,
Jason Ekstrand <jason@jlekstrand.net>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH] drm/i915: Fix integer overflow tests
Date: Thu, 17 Aug 2017 12:50:37 +0300 [thread overview]
Message-ID: <20170817094446.rwjpo5jo76oksjog@mwanda> (raw)
In-Reply-To: <20170817093700.5srkwji7mxexouts@ideak-desk.fi.intel.com>
On Thu, Aug 17, 2017 at 12:37:00PM +0300, Imre Deak wrote:
> On Thu, Aug 17, 2017 at 09:23:10AM +0300, Dan Carpenter wrote:
> > There are some potential integer overflows here on 64 bit systems.
> >
> > The condition "if (nfences > SIZE_MAX / sizeof(*fences))" can only be
> > true on 32 bit systems, it's a no-op on 64 bit, so let's ignore the
> > check for now and look a couple lines after:
> >
> > if (!access_ok(VERIFY_READ, user, nfences * 2 * sizeof(u32)))
> > ^^^^^^^^^^^
> > "nfences" is an unsigned int, so if we set it to UINT_MAX and multiply
> > by two, it's going to have an integer overflow.
>
> AFAICS it wouldn't overflow due the promotion to unsigned long
> by '* sizeof(u32)'.
>
It first multplies "nfences * 2" as unsigned int, then it type promotes
to size_t and multiplies by sizeof(). Only the first multiplication has
an integer overflow bug.
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-08-17 9:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 6:23 [PATCH] drm/i915: Fix integer overflow tests Dan Carpenter
2017-08-17 6:42 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-08-17 9:37 ` [PATCH] " Imre Deak
2017-08-17 9:50 ` Dan Carpenter [this message]
2017-08-17 9:56 ` Imre Deak
2017-08-17 14:16 ` Jason Ekstrand
2017-08-17 14:32 ` Dan Carpenter
2017-08-18 7:07 ` [PATCH v2] " Dan Carpenter
2017-08-18 7:46 ` Chris Wilson
2017-08-18 8:01 ` Dan Carpenter
2017-08-17 10:00 ` [PATCH] drm/i915: Prevent overflow of execbuf.buffer_count and num_cliprects Chris Wilson
2017-08-17 10:36 ` [PATCH v2] " Chris Wilson
2017-08-17 10:26 ` ✓ Fi.CI.BAT: success for drm/i915: Fix integer overflow tests (rev2) Patchwork
2017-08-17 11:00 ` ✓ Fi.CI.BAT: success for drm/i915: Fix integer overflow tests (rev3) Patchwork
2017-08-18 7:40 ` ✓ Fi.CI.BAT: success for drm/i915: Fix integer overflow tests (rev4) 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=20170817094446.rwjpo5jo76oksjog@mwanda \
--to=dan.carpenter@oracle.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jason@jlekstrand.net \
--cc=kernel-janitors@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: 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