Skip to content

Commit

Permalink
lightnvm: return the correct return value
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Matias Bjørling <matias.bjorling@wdc.com>
Link: https://lore.kernel.org/r/20210413105257.159260-3-matias.bjorling@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Tian Tao authored and Jens Axboe committed Apr 13, 2021
1 parent 327e1d2 commit 1c6b0bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/lightnvm/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1c6b0bc

Please sign in to comment.