The error return code of memdup_user() should be -ENOMEM or -EFAULT.
So this patch changed it to PTR_ERR(info).

Signed-off-by: Geliang Tang <geliangt...@gmail.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 54a06c3..e8b5edd 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -1164,7 +1164,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.9.3

Reply via email to