From: Tian Tao Date: Tue, 13 Apr 2021 10:52:55 +0000 (+0000) Subject: lightnvm: return the correct return value X-Git-Tag: v5.13-rc1~116^2~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c6b0bc73fac9306462bd4794d00520690e97ef8;p=thirdparty%2Fkernel%2Flinux.git lightnvm: return the correct return value 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 Signed-off-by: Matias Bjørling Link: https://lore.kernel.org/r/20210413105257.159260-3-matias.bjorling@wdc.com Signed-off-by: Jens Axboe --- diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 28ddcaa5358b1..42774beeba94d 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;