From: Daniel Vetter <daniel@ffwll.ch>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
stable@vger.kernel.org, gnomes@lxorguk.ukuu.org.uk,
"open list:DRM DRIVERS" <dri-devel@lists.freedesktop.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] qxl: use kmalloc_array to alloc reloc_info in qxl_process_single_command
Date: Tue, 16 Feb 2016 15:23:33 +0100 [thread overview]
Message-ID: <20160216142333.GD32705@phenom.ffwll.local> (raw)
In-Reply-To: <1455629100-4392-1-git-send-email-kraxel@redhat.com>
On Tue, Feb 16, 2016 at 02:25:00PM +0100, Gerd Hoffmann wrote:
> This avoids integer overflows on 32bit machines when calculating
> reloc_info size, as reported by Alan Cox.
>
> Cc: stable@vger.kernel.org
> Cc: gnomes@lxorguk.ukuu.org.uk
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/qxl/qxl_ioctl.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
> index 2ae8577..7c2e782 100644
> --- a/drivers/gpu/drm/qxl/qxl_ioctl.c
> +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
> @@ -168,7 +168,8 @@ static int qxl_process_single_command(struct qxl_device *qdev,
> cmd->command_size))
> return -EFAULT;
>
> - reloc_info = kmalloc(sizeof(struct qxl_reloc_info) * cmd->relocs_num, GFP_KERNEL);
> + reloc_info = kmalloc_array(cmd->relocs_num,
> + sizeof(struct qxl_reloc_info), GFP_KERNEL);
> if (!reloc_info)
> return -ENOMEM;
>
> --
> 1.8.3.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
prev parent reply other threads:[~2016-02-16 14:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 13:25 [PATCH v2] qxl: use kmalloc_array to alloc reloc_info in qxl_process_single_command Gerd Hoffmann
2016-02-16 14:23 ` Daniel Vetter [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=20160216142333.GD32705@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.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: 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