staging: lustre: selftest: freeing an error pointer

We should just return directly if memdup_user() fails. The current code
tries to free "param" which is an error pointer so it will Oops.

Fixes: 2baddf262e ("staging: lustre: use memdup_user to allocate memory and copy from user")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dan Carpenter 2018-02-22 12:15:34 +03:00 committed by Greg Kroah-Hartman
parent 52edc44ffb
commit a139834ed6
1 changed files with 2 additions and 4 deletions

View File

@ -650,10 +650,8 @@ static int lst_test_add_ioctl(struct lstio_test_args *args)
if (args->lstio_tes_param) {
param = memdup_user(args->lstio_tes_param,
args->lstio_tes_param_len);
if (IS_ERR(param)) {
rc = PTR_ERR(param);
goto out;
}
if (IS_ERR(param))
return PTR_ERR(param);
}
rc = -EFAULT;