Skip to content

Commit 0bd46e2

Browse files
Dan CarpenterChristoph Hellwig
authored andcommitted
nvmet: fix a width vs precision bug in nvmet_subsys_attr_serial_show()
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: f040648 ("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>
1 parent 67f3b2f commit 0bd46e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvme/target/configfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
10671067
{
10681068
struct nvmet_subsys *subsys = to_subsys(item);
10691069

1070-
return snprintf(page, PAGE_SIZE, "%*s\n",
1070+
return snprintf(page, PAGE_SIZE, "%.*s\n",
10711071
NVMET_SN_MAX_SIZE, subsys->serial);
10721072
}
10731073

0 commit comments

Comments
 (0)