X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=examples%2Fvhost_scsi%2Fscsi.c;h=47c5c83cf1903659cad86e6db51117f017d593a1;hb=6e7cbd63706f3435b9d9a2057a37db1da01db9a7;hp=54d3104ed5045a2daf98d4acd78e49ac6014b82b;hpb=f239aed5e674965691846e8ce3f187dd47523689;p=deb_dpdk.git diff --git a/examples/vhost_scsi/scsi.c b/examples/vhost_scsi/scsi.c index 54d3104e..47c5c83c 100644 --- a/examples/vhost_scsi/scsi.c +++ b/examples/vhost_scsi/scsi.c @@ -210,7 +210,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, break; case SPC_VPD_UNIT_SERIAL_NUMBER: hlen = 4; - strncpy((char *)vpage->params, bdev->name, 32); + memcpy((char *)vpage->params, bdev->name, 32); vpage->alloc_len = rte_cpu_to_be_16(32); break; case SPC_VPD_DEVICE_IDENTIFICATION: @@ -247,7 +247,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, strncpy((char *)desig->desig, "INTEL", 8); vhost_strcpy_pad((char *)&desig->desig[8], bdev->product_name, 16, ' '); - strncpy((char *)&desig->desig[24], bdev->name, 32); + memcpy((char *)&desig->desig[24], bdev->name, 32); len += sizeof(struct scsi_desig_desc) + 8 + 16 + 32; buf += sizeof(struct scsi_desig_desc) + desig->len; @@ -307,10 +307,12 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev, strncpy((char *)inqdata->t10_vendor_id, "INTEL", 8); /* PRODUCT IDENTIFICATION */ - strncpy((char *)inqdata->product_id, bdev->product_name, 16); + snprintf((char *)inqdata->product_id, + RTE_DIM(inqdata->product_id), "%s", + bdev->product_name); /* PRODUCT REVISION LEVEL */ - strncpy((char *)inqdata->product_rev, "0001", 4); + memcpy((char *)inqdata->product_rev, "0001", 4); /* Standard inquiry data ends here. Only populate * remaining fields if alloc_len indicates enough