* [PATCH] lightnvm: Return the correct return value
@ 2021-04-12 7:38 Tian Tao
2021-04-13 10:54 ` Matias Bjørling
0 siblings, 1 reply; 2+ messages in thread
From: Tian Tao @ 2021-04-12 7:38 UTC (permalink / raw)
To: mb; +Cc: linux-block, Tian Tao
When memdup_user returns an error, memdup_user has two different return
values, use PTR_ERR to get the correct return value.
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
drivers/lightnvm/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 28ddcaa..42774be 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -1257,7 +1257,7 @@ static long nvm_ioctl_info(struct file *file, void __user *arg)
info = memdup_user(arg, sizeof(struct nvm_ioctl_info));
if (IS_ERR(info))
- return -EFAULT;
+ return PTR_ERR(info);
info->version[0] = NVM_VERSION_MAJOR;
info->version[1] = NVM_VERSION_MINOR;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lightnvm: Return the correct return value
2021-04-12 7:38 [PATCH] lightnvm: Return the correct return value Tian Tao
@ 2021-04-13 10:54 ` Matias Bjørling
0 siblings, 0 replies; 2+ messages in thread
From: Matias Bjørling @ 2021-04-13 10:54 UTC (permalink / raw)
To: Tian Tao; +Cc: linux-block
On 12/04/2021 09.38, Tian Tao wrote:
> When memdup_user returns an error, memdup_user has two different return
> values, use PTR_ERR to get the correct return value.
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
> drivers/lightnvm/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
> index 28ddcaa..42774be 100644
> --- a/drivers/lightnvm/core.c
> +++ b/drivers/lightnvm/core.c
> @@ -1257,7 +1257,7 @@ static long nvm_ioctl_info(struct file *file, void __user *arg)
>
> info = memdup_user(arg, sizeof(struct nvm_ioctl_info));
> if (IS_ERR(info))
> - return -EFAULT;
> + return PTR_ERR(info);
>
> info->version[0] = NVM_VERSION_MAJOR;
> info->version[1] = NVM_VERSION_MINOR;
Thanks, Tian. It has been pulled.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-13 10:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 7:38 [PATCH] lightnvm: Return the correct return value Tian Tao
2021-04-13 10:54 ` Matias Bjørling
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.