]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet: change sn size and check validity
authorNoam Gottlieb <ngottlieb@nvidia.com>
Mon, 7 Jun 2021 09:23:21 +0000 (12:23 +0300)
committerChristoph Hellwig <hch@lst.de>
Thu, 17 Jun 2021 13:51:19 +0000 (15:51 +0200)
commite6c552fd2db9e14462013aefec550fc54837cedc
tree6fe78c77b7fffb70076c6c9c165e98cec7315ac1
parent01e2456e2ae846085a372f0c073eb0a309355eb6
nvmet: change sn size and check validity

According to the NVM specification, the serial_number should be 20 bytes
(bytes 23:04 of the Identify Controller data structure), and should
contain only ASCII characters.

In accordance, the serial_number size is changed to 20 bytes and before
any attempt to store a new value in serial_number we check that the
input is valid - i.e. contains only ASCII characters, is not empty and
does not exceed 20 bytes.

Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Noam Gottlieb <ngottlieb@nvidia.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/admin-cmd.c
drivers/nvme/target/configfs.c
drivers/nvme/target/core.c
drivers/nvme/target/discovery.c
drivers/nvme/target/nvmet.h