]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet: fixup buffer overrun in nvmet_subsys_attr_serial()
authorHannes Reinecke <hare@suse.de>
Mon, 6 Sep 2021 07:04:03 +0000 (09:04 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 6 Sep 2021 08:03:11 +0000 (10:03 +0200)
commitcba3ef2626074eda9268cd8e968e3968f961825c
tree7d92afdf4f4a566da0da52bc99c8ac2603935165
parenta7f2fe3bbeb3029a2bbbf3e085935081ed7146b9
nvmet: fixup buffer overrun in nvmet_subsys_attr_serial()

The serial number is copied into the buffer via memcpy_and_pad()
with the length NVMET_SN_MAX_SIZE. So when printing out we also
need to take just that length as anything beyond that will be
uninitialized.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/configfs.c