Skip to content

Commit 9317d00

Browse files
author
Christoph Hellwig
committed
nvme-fc: fix the fc_appid_store return value
"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. Fixes: c814153 ("nvme-fc: fold t fc_update_appid into fc_appid_store") Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Ewan D. Milne <[email protected]> Reviewed-by: James Smart <[email protected]> Tested-by: Muneendra Kumar M <[email protected]>
1 parent 6fb271f commit 9317d00

File tree

1 file changed

+2
-1
lines changed
  • drivers/nvme/host

1 file changed

+2
-1
lines changed

drivers/nvme/host/fc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3880,6 +3880,7 @@ static int fc_parse_cgrpid(const char *buf, u64 *id)
38803880
static ssize_t fc_appid_store(struct device *dev,
38813881
struct device_attribute *attr, const char *buf, size_t count)
38823882
{
3883+
size_t orig_count = count;
38833884
u64 cgrp_id;
38843885
int appid_len = 0;
38853886
int cgrpid_len = 0;
@@ -3904,7 +3905,7 @@ static ssize_t fc_appid_store(struct device *dev,
39043905
ret = blkcg_set_fc_appid(app_id, cgrp_id, sizeof(app_id));
39053906
if (ret < 0)
39063907
return ret;
3907-
return count;
3908+
return orig_count;
39083909
}
39093910
static DEVICE_ATTR(appid_store, 0200, NULL, fc_appid_store);
39103911
#endif /* CONFIG_BLK_CGROUP_FC_APPID */

0 commit comments

Comments
 (0)