From: Dan Carpenter <dan.carpenter@oracle.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
Jason Ekstrand <jason@jlekstrand.net>,
Jani Nikula <jani.nikula@linux.intel.com>,
David Airlie <airlied@linux.ie>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] drm/i915: Fix integer overflow tests
Date: Fri, 18 Aug 2017 11:01:03 +0300 [thread overview]
Message-ID: <20170818080103.onzmbiyobjt6yhhg@mwanda> (raw)
In-Reply-To: <150304238594.1452.15324933027021845692@mail.alporthouse.com>
On Fri, Aug 18, 2017 at 08:46:25AM +0100, Chris Wilson wrote:
> Quoting Dan Carpenter (2017-08-18 08:07:00)
> > 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. The multiplication by
> > sizeof(u32) is OK because that gets type promoted to size_t. This patch
> > changes the access_ok() check to use sizeof(*user) which fixes the
> > integer overflow and is also more readable.
> >
> > The "args->buffer_count" variable is an unsigned int as well so it could
> > overflow if it's set to UINT_MAX when we do:
> >
> > exec2_list = kvmalloc_array(args->buffer_count + 1, sz,
> > ^^^^^^^^^^^^^^^^^^^^^^
> >
> > Originally, those two integer overflow checks were against UINT_MAX
> > instead of SIZE_MAX and this patch changes them back.
> >
> > Fixes: 2889caa92321 ("drm/i915: Eliminate lots of iterations over the execobjects array")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > v2: Use sizeof(*users)
>
> Please do consider my alternative.
I don't think you sent the email? I haven't recieved any emails from
you on either my oracle.com address or through the kernel janitors list.
Can you resend?
regards
dan carpenter
next prev parent reply other threads:[~2017-08-18 8:01 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
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 [this message]
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=20170818080103.onzmbiyobjt6yhhg@mwanda \
--to=dan.carpenter@oracle.com \
--cc=airlied@linux.ie \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--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