diff options
author | Noam Gottlieb <ngottlieb@nvidia.com> | 2021-06-07 11:23:21 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2021-06-17 15:51:19 +0200 |
commit | e13b061589ace0aee18bdbf86f3ddb2b6b5b5ab8 (patch) | |
tree | 6fe78c77b7fffb70076c6c9c165e98cec7315ac1 /drivers/nvme/target/nvmet.h | |
parent | nvmet-fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst() (diff) | |
download | linux-e13b061589ace0aee18bdbf86f3ddb2b6b5b5ab8.tar.xz linux-e13b061589ace0aee18bdbf86f3ddb2b6b5b5ab8.zip |
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>
Diffstat (limited to 'drivers/nvme/target/nvmet.h')
-rw-r--r-- | drivers/nvme/target/nvmet.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index d69a409515d6..0ae809ca428c 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h @@ -28,6 +28,7 @@ #define NVMET_NO_ERROR_LOC ((u16)-1) #define NVMET_DEFAULT_CTRL_MODEL "Linux" #define NVMET_MN_MAX_SIZE 40 +#define NVMET_SN_MAX_SIZE 20 /* * Supported optional AENs: @@ -229,7 +230,7 @@ struct nvmet_subsys { u16 max_qid; u64 ver; - u64 serial; + char serial[NVMET_SN_MAX_SIZE]; char *subsysnqn; bool pi_support; |