nvmet: fix a width vs precision bug in nvmet_subsys_attr_serial_show()
Subsystems (3)
PATCH 1/1 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 f04064814c2a ("nvmet: fixup buffer overrun in nvmet_subsys_attr_serial()")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/nvme/target/configfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/configfs.c +1 -1
@@ -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); }
Signature · 1 line
2.20.1
Thanks,
applied to nvme-5.15.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme