From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Christoph Hellwig <hch@lst.de>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Cc: "Ewan D . Milne" <emilne@redhat.com>,
James Smart <jsmart2021@gmail.com>,
Muneendra Kumar M <muneendra.kumar@broadcom.com>
Subject: Re: [PATCH] nvme-fc: fix the fc_appid_store return value
Date: Sun, 7 Aug 2022 09:23:27 +0000 [thread overview]
Message-ID: <d6867d59-9e1b-78c7-6832-3157bc0fda61@nvidia.com> (raw)
In-Reply-To: <20220806083228.3826126-1-hch@lst.de>
On 8/6/22 01:32, Christoph Hellwig wrote:
> "nvme-fc: fold t fc_update_appid into fc_appid_store" accidentally
> changed the userspace interface for the appid attribute, because the code
> that decrements "count" to remove a trailing '\n' in the parsing results
> in the decremented value being incorrectly be returned from the sysfs
> write. Fix this by keeping an orig_count variable for the full length
> of the write.
>
>
while we are at it perhaps we should consider fixing following ?
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 8d14df8eeab8..7ba35b059214 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3886,10 +3886,10 @@ static ssize_t fc_appid_store(struct device *dev,
char app_id[FC_APPID_LEN];
int ret = 0;
- if (buf[count-1] == '\n')
+ if (buf[count - 1] == '\n')
count--;
- if ((count > (16+1+FC_APPID_LEN)) || (!strchr(buf, ':')))
+ if ((count > (16 + 1 + FC_APPID_LEN)) || (!strchr(buf, ':')))
return -EINVAL;
cgrpid_len = fc_parse_cgrpid(buf, &cgrp_id);
@@ -3900,7 +3900,7 @@ static ssize_t fc_appid_store(struct device *dev,
return -EINVAL;
memset(app_id, 0x0, sizeof(app_id));
- memcpy(app_id, &buf[cgrpid_len+1], appid_len);
+ memcpy(app_id, &buf[cgrpid_len + 1], appid_len);
ret = blkcg_set_fc_appid(app_id, cgrp_id, sizeof(app_id));
if (ret < 0)
return ret;
or lmk if I should send a different patch..
-ck
next prev parent reply other threads:[~2022-08-07 9:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-06 8:32 [PATCH] nvme-fc: fix the fc_appid_store return value Christoph Hellwig
2022-08-07 9:21 ` Chaitanya Kulkarni
2022-08-07 9:23 ` Chaitanya Kulkarni [this message]
2022-08-10 14:23 ` Christoph Hellwig
2022-08-28 12:11 ` Sagi Grimberg
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=d6867d59-9e1b-78c7-6832-3157bc0fda61@nvidia.com \
--to=chaitanyak@nvidia.com \
--cc=emilne@redhat.com \
--cc=hch@lst.de \
--cc=jsmart2021@gmail.com \
--cc=linux-nvme@lists.infradead.org \
--cc=muneendra.kumar@broadcom.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