linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Krowiak <akrowiak@linux.ibm.com>
To: Wang Qing <wangqing@vivo.com>,
	Pierre Morel <pmorel@linux.ibm.com>,
	Halil Pasic <pasic@linux.ibm.com>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] s390: crypto: Return -EFAULT if copy_to_user() fails
Date: Mon, 1 Mar 2021 07:18:20 -0500	[thread overview]
Message-ID: <ffe84ace-92db-c7f5-7e66-fe3172484ec6@linux.ibm.com> (raw)
In-Reply-To: <1614600502-16714-1-git-send-email-wangqing@vivo.com>



On 3/1/21 7:08 AM, Wang Qing wrote:
> The copy_to_user() function returns the number of bytes remaining to be
> copied, but we want to return -EFAULT if the copy doesn't complete.
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
> ---
>   drivers/s390/crypto/vfio_ap_ops.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
> index 41fc2e413..1ffdd41
> --- a/drivers/s390/crypto/vfio_ap_ops.c
> +++ b/drivers/s390/crypto/vfio_ap_ops.c
> @@ -1286,7 +1286,7 @@ static int vfio_ap_mdev_get_device_info(unsigned long arg)
>   	info.num_regions = 0;
>   	info.num_irqs = 0;
>   
> -	return copy_to_user((void __user *)arg, &info, minsz);
> +	return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
>   }

LGTM
Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>

>   
>   static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,


  reply	other threads:[~2021-03-01 12:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 12:08 [PATCH] s390: crypto: Return -EFAULT if copy_to_user() fails Wang Qing
2021-03-01 12:18 ` Tony Krowiak [this message]
2021-03-01 13:13 ` Heiko Carstens

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=ffe84ace-92db-c7f5-7e66-fe3172484ec6@linux.ibm.com \
    --to=akrowiak@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pasic@linux.ibm.com \
    --cc=pmorel@linux.ibm.com \
    --cc=wangqing@vivo.com \
    /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;
as well as URLs for NNTP newsgroup(s).