From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Subject: Re: [PATCH] scsi: sd: Use sysfs_match_string()
Date: Fri, 26 May 2017 21:09:46 +0000 [thread overview]
Message-ID: <1495832984.2634.4.camel@sandisk.com> (raw)
In-Reply-To: <20170526170239.19709-1-martin.petersen@oracle.com>
On Fri, 2017-05-26 at 13:02 -0400, Martin K. Petersen wrote:
> Avoid unnecessary snprintf() when formatting variables for display in
> sysfs and switch to sysfs_match_string() for validating user input.
Hello Martin,
Would it be worth it to split this patch into two patches - one for the
snprintf() conversion and another patch for the sysfs_match_string()
conversion?
> @@ -155,7 +155,7 @@ static ssize_t
> cache_type_store(struct device *dev, struct device_attribute *attr,
> const char *buf, size_t count)
> {
> - int i, ct = -1, rcd, wce, sp;
> + int ct = -1, rcd, wce, sp;
Is it still necessary to initialize ct in this function?
> + mode = sysfs_match_string(lbp_mode, buf);
> + if (mode < 0)
> return -EINVAL;
> [ ... ]
> + mode = sysfs_match_string(zeroing_mode, buf);
> + if (mode < 0)
> return -EINVAL;
sysfs_match_string() only supports dense arrays. Maybe it's worth to add a
comment above lbp_mode[] and zeroing_mode[] that these must be dense arrays
or that the above calls to sysfs_match_string() will break?
Otherwise this patch looks fine to me.
Bart.
prev parent reply other threads:[~2017-05-26 21:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-26 17:02 [PATCH] scsi: sd: Use sysfs_match_string() Martin K. Petersen
2017-05-26 21:09 ` Bart Van Assche [this message]
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=1495832984.2634.4.camel@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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