aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/nvme-scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/nvme-scsi.c')
-rw-r--r--drivers/block/nvme-scsi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/nvme-scsi.c b/drivers/block/nvme-scsi.c
index 13403ee716da..4fc25b980535 100644
--- a/drivers/block/nvme-scsi.c
+++ b/drivers/block/nvme-scsi.c
@@ -681,6 +681,7 @@ static int nvme_trans_standard_inquiry_page(struct nvme_ns *ns,
681 u8 resp_data_format = 0x02; 681 u8 resp_data_format = 0x02;
682 u8 protect; 682 u8 protect;
683 u8 cmdque = 0x01 << 1; 683 u8 cmdque = 0x01 << 1;
684 u8 fw_offset = sizeof(dev->firmware_rev);
684 685
685 mem = dma_alloc_coherent(&dev->pci_dev->dev, sizeof(struct nvme_id_ns), 686 mem = dma_alloc_coherent(&dev->pci_dev->dev, sizeof(struct nvme_id_ns),
686 &dma_addr, GFP_KERNEL); 687 &dma_addr, GFP_KERNEL);
@@ -716,7 +717,11 @@ static int nvme_trans_standard_inquiry_page(struct nvme_ns *ns,
716 inq_response[7] = cmdque; /* wbus16=0 | sync=0 | vs=0 */ 717 inq_response[7] = cmdque; /* wbus16=0 | sync=0 | vs=0 */
717 strncpy(&inq_response[8], "NVMe ", 8); 718 strncpy(&inq_response[8], "NVMe ", 8);
718 strncpy(&inq_response[16], dev->model, 16); 719 strncpy(&inq_response[16], dev->model, 16);
719 strncpy(&inq_response[32], dev->firmware_rev, 4); 720
721 while (dev->firmware_rev[fw_offset - 1] == ' ' && fw_offset > 4)
722 fw_offset--;
723 fw_offset -= 4;
724 strncpy(&inq_response[32], dev->firmware_rev + fw_offset, 4);
720 725
721 xfer_len = min(alloc_len, STANDARD_INQUIRY_LENGTH); 726 xfer_len = min(alloc_len, STANDARD_INQUIRY_LENGTH);
722 res = nvme_trans_copy_to_user(hdr, inq_response, xfer_len); 727 res = nvme_trans_copy_to_user(hdr, inq_response, xfer_len);