diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-09-09 12:14:40 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-30 10:13:08 +0200 |
commit | d401d7d2f5c8e40f418300b3c1e4bc2670f65558 (patch) | |
tree | bbed20c237af0a9b74af291fd17842e99131d523 | |
parent | 958c616efce30c575479a01c123f108415241a8d (diff) |
nvmet: fix a width vs precision bug in nvmet_subsys_attr_serial_show()
commit 0bd46e22c5ec3dbfb81b60de475151e3f6b411c2 upstream.
This was intended to limit the number of characters printed from
"subsys->serial" to NVMET_SN_MAX_SIZE. But accidentally the width
specifier was used instead of the precision specifier so it only
affects the alignment and not the number of characters printed.
Fixes: f04064814c2a ("nvmet: fixup buffer overrun in nvmet_subsys_attr_serial()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/nvme/target/configfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c index fa88bf9cba4d..3e5053c5ec83 100644 --- a/drivers/nvme/target/configfs.c +++ b/drivers/nvme/target/configfs.c @@ -1067,7 +1067,7 @@ static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item, { struct nvmet_subsys *subsys = to_subsys(item); - return snprintf(page, PAGE_SIZE, "%*s\n", + return snprintf(page, PAGE_SIZE, "%.*s\n", NVMET_SN_MAX_SIZE, subsys->serial); } |