linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Knauf <florian.knauf@stud.uni-hannover.de>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Cc: linux-kernel@i4.cs.fau.de, Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Florian Knauf <florian.knauf@stud.uni-hannover.de>,
	Christian Ewert <christian.ewert@stud.uni-hannover.de>
Subject: [PATCH v2] drivers/block/loop: Replace deprecated function in option parsing code
Date: Tue, 25 Jun 2019 19:55:17 +0200	[thread overview]
Message-ID: <20190625175517.31133-1-florian.knauf@stud.uni-hannover.de> (raw)
In-Reply-To: <BYAPR04MB574936B98A60EB42B9A7C97886E30@BYAPR04MB5749.namprd04.prod.outlook.com>

This patch removes the deprecated simple_strtol function from the option
parsing logic in the loopback device driver. Instead kstrtoint is used to
parse int max_loop, to ensure that input values it cannot represent are
ignored.

Signed-off-by: Florian Knauf <florian.knauf@stud.uni-hannover.de>
Signed-off-by: Christian Ewert <christian.ewert@stud.uni-hannover.de>
---
Thank you for your feedback.

There's no specific reason to use kstrtol, other than the fact that we
weren't yet aware that kstrtoint exists. (We're new at this, I'm afraid.)

We've amended the patch to make use of kstrtoint, which is of course much
more straightforward.

drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 102d79575895..adfaf4ad37d1 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -2289,7 +2289,7 @@ module_exit(loop_exit);
 #ifndef MODULE
 static int __init max_loop_setup(char *str)
 {
-	max_loop = simple_strtol(str, NULL, 0);
+	kstrtoint(str, 0, &max_loop);
 	return 1;
 }
 
-- 
2.17.1


  reply	other threads:[~2019-06-25 17:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 11:40 [PATCH] drivers/block/loop: Remove deprecated function, range check for max_loop Florian Knauf
2019-06-25 15:42 ` Chaitanya Kulkarni
2019-06-25 17:55   ` Florian Knauf [this message]
2019-06-25 19:24     ` [PATCH v2] drivers/block/loop: Replace deprecated function in option parsing code Chaitanya Kulkarni
2019-06-29 19:46       ` Florian Knauf
2019-07-02  5:04         ` Chaitanya Kulkarni

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=20190625175517.31133-1-florian.knauf@stud.uni-hannover.de \
    --to=florian.knauf@stud.uni-hannover.de \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=christian.ewert@stud.uni-hannover.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@i4.cs.fau.de \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).