From: Frediano Ziglio <fziglio@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dave Airlie <airlied@redhat.com>,
kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [patch 4/4 v2] drm/qxl: integer overflow in qxl_alloc_surf_ioctl()
Date: Wed, 23 Sep 2015 10:45:05 +0000 [thread overview]
Message-ID: <151358038.30813068.1443005105969.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20150922143208.GA2319@mwanda>
>
> The size calculation can overflow. I don't know if this leads to
> memory corruption, but it causes a static checker warning.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: I don't know think the size is capped anywhere. In my first version
> of this patch, I introduced a divide by zero bug.
>
Beside the second sentence I would ack
Frediano
> diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c
> b/drivers/gpu/drm/qxl/qxl_ioctl.c
> index b2db482..49b3158 100644
> --- a/drivers/gpu/drm/qxl/qxl_ioctl.c
> +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
> @@ -396,12 +396,14 @@ static int qxl_alloc_surf_ioctl(struct drm_device *dev,
> void *data,
> struct qxl_bo *qobj;
> int handle;
> int ret;
> - int size, actual_stride;
> + u64 size, actual_stride;
> struct qxl_surface surf;
>
> /* work out size allocate bo with handle */
> actual_stride = param->stride < 0 ? -param->stride : param->stride;
> size = actual_stride * param->height + actual_stride;
> + if (size > INT_MAX)
> + return -EINVAL;
>
> surf.format = param->format;
> surf.width = param->width;
>
prev parent reply other threads:[~2015-09-23 10:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <421515033.28673933.1442569564307.JavaMail.zimbra@redhat.com>
2015-09-22 14:32 ` [patch 4/4 v2] drm/qxl: integer overflow in qxl_alloc_surf_ioctl() Dan Carpenter
2015-09-23 10:45 ` Frediano Ziglio [this message]
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=151358038.30813068.1443005105969.JavaMail.zimbra@redhat.com \
--to=fziglio@redhat.com \
--cc=airlied@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=dri-devel@lists.freedesktop.org \
--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