summaryrefslogtreecommitdiff
path: root/drivers/nvme/target/discovery.c
diff options
context:
space:
mode:
authorSagi Grimberg <sagi@grimberg.me>2019-10-24 19:55:58 +0300
committerJens Axboe <axboe@kernel.dk>2019-11-04 20:56:42 +0300
commitd4b3a1741130dfc812b0825db4cb1c61032da183 (patch)
tree12f2a6844121c2198d11a881806684f2cad3403b /drivers/nvme/target/discovery.c
parentbe3f3114ddd58d12f64b872247bb1bc46df56b36 (diff)
downloadlinux-d4b3a1741130dfc812b0825db4cb1c61032da183.tar.xz
nvmet: fill discovery controller sn, fr and mn correctly
Discovery controllers need this information as well. Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/nvme/target/discovery.c')
-rw-r--r--drivers/nvme/target/discovery.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c
index 7a868c3e8e95..0c2274b21e15 100644
--- a/drivers/nvme/target/discovery.c
+++ b/drivers/nvme/target/discovery.c
@@ -241,6 +241,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
{
struct nvmet_ctrl *ctrl = req->sq->ctrl;
struct nvme_id_ctrl *id;
+ const char model[] = "Linux";
u16 status = 0;
if (!nvmet_check_data_len(req, NVME_IDENTIFY_DATA_SIZE))
@@ -258,8 +259,13 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
goto out;
}
+ memset(id->sn, ' ', sizeof(id->sn));
+ bin2hex(id->sn, &ctrl->subsys->serial,
+ min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2));
memset(id->fr, ' ', sizeof(id->fr));
- strncpy((char *)id->fr, UTS_RELEASE, sizeof(id->fr));
+ memcpy_and_pad(id->mn, sizeof(id->mn), model, sizeof(model) - 1, ' ');
+ memcpy_and_pad(id->fr, sizeof(id->fr),
+ UTS_RELEASE, strlen(UTS_RELEASE), ' ');
/* no limit on data transfer sizes for now */
id->mdts = 0;