public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lustre-devel@lists.lustre.org
Subject: [PATCH] staging: lustre: selftest: freeing an error pointer
Date: Thu, 22 Feb 2018 09:15:34 +0000	[thread overview]
Message-ID: <20180222091534.GD9883@mwanda> (raw)

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: 2baddf262e98 ("staging: lustre: use memdup_user to allocate memory and copy from user")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c
index 3c919a536e91..51497cf9a832 100644
--- a/drivers/staging/lustre/lnet/selftest/conctl.c
+++ b/drivers/staging/lustre/lnet/selftest/conctl.c
@@ -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;

                 reply	other threads:[~2018-02-22  9:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180222091534.GD9883@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=lustre-devel@lists.lustre.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox