All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thellstrom@vmware.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Dave Airlie <airlied@redhat.com>, Thomas Meyer <thomas@m3y3r.de>
Subject: Re: [patch] vmwgfx: return an -EFAULT if copy_to_user() fails
Date: Tue, 13 Nov 2012 20:57:24 +0000	[thread overview]
Message-ID: <50A2B434.3090000@vmware.com> (raw)
In-Reply-To: <20121112110724.GA1678@elgon.mountain>

On 11/12/2012 12:07 PM, Dan Carpenter wrote:
> copy_to_user() returns the number of bytes remaining to be copied, but
> we want to return a negative error code here.  I fixed a couple of these
> last year, but I missed this one.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I think there were only three copy_to/from_user() functions in this
> file and they're all fixed now.
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
> index b07ca2e..7290811 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
> @@ -110,6 +110,8 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data,
>   	memcpy_fromio(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size);
>   
>   	ret = copy_to_user(buffer, bounce, size);
> +	if (ret)
> +		ret = -EFAULT;
>   	vfree(bounce);
>   
>   	if (unlikely(ret != 0))
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>


WARNING: multiple messages have this Message-ID (diff)
From: Thomas Hellstrom <thellstrom@vmware.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Dave Airlie <airlied@redhat.com>, Thomas Meyer <thomas@m3y3r.de>
Subject: Re: [patch] vmwgfx: return an -EFAULT if copy_to_user() fails
Date: Tue, 13 Nov 2012 21:57:24 +0100	[thread overview]
Message-ID: <50A2B434.3090000@vmware.com> (raw)
In-Reply-To: <20121112110724.GA1678@elgon.mountain>

On 11/12/2012 12:07 PM, Dan Carpenter wrote:
> copy_to_user() returns the number of bytes remaining to be copied, but
> we want to return a negative error code here.  I fixed a couple of these
> last year, but I missed this one.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I think there were only three copy_to/from_user() functions in this
> file and they're all fixed now.
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
> index b07ca2e..7290811 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
> @@ -110,6 +110,8 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data,
>   	memcpy_fromio(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size);
>   
>   	ret = copy_to_user(buffer, bounce, size);
> +	if (ret)
> +		ret = -EFAULT;
>   	vfree(bounce);
>   
>   	if (unlikely(ret != 0))
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>

  reply	other threads:[~2012-11-13 20:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-12 11:07 [patch] vmwgfx: return an -EFAULT if copy_to_user() fails Dan Carpenter
2012-11-12 11:07 ` Dan Carpenter
2012-11-13 20:57 ` Thomas Hellstrom [this message]
2012-11-13 20:57   ` Thomas Hellstrom

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=50A2B434.3090000@vmware.com \
    --to=thellstrom@vmware.com \
    --cc=airlied@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=thomas@m3y3r.de \
    /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 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.