Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/40189/?format=api
http://patches.dpdk.org/api/patches/40189/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1526599932-13083-2-git-send-email-changpeng.liu@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1526599932-13083-2-git-send-email-changpeng.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1526599932-13083-2-git-send-email-changpeng.liu@intel.com", "date": "2018-05-17T23:32:12", "name": "[dpdk-dev,2/2] examples/vhost_scsi: fix potential buffer overrun with safe copy API", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "4d59c8d08ab18d98c3f74cf4efaa2c429e9f804b", "submitter": { "id": 565, "url": "http://patches.dpdk.org/api/people/565/?format=api", "name": "Liu, Changpeng", "email": "changpeng.liu@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1526599932-13083-2-git-send-email-changpeng.liu@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/40189/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/40189/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C006C8E78;\n\tFri, 18 May 2018 01:23:04 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id A49588E5B\n\tfor <dev@dpdk.org>; Fri, 18 May 2018 01:22:58 +0200 (CEST)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t17 May 2018 16:22:58 -0700", "from fedora.sh.intel.com ([10.67.114.176])\n\tby fmsmga007.fm.intel.com with ESMTP; 17 May 2018 16:22:57 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.49,412,1520924400\"; d=\"scan'208\";a=\"40250397\"", "From": "Changpeng Liu <changpeng.liu@intel.com>", "To": "changpeng.liu@intel.com,\n\tdev@dpdk.org", "Date": "Fri, 18 May 2018 07:32:12 +0800", "Message-Id": "<1526599932-13083-2-git-send-email-changpeng.liu@intel.com>", "X-Mailer": "git-send-email 1.9.3", "In-Reply-To": "<1526599932-13083-1-git-send-email-changpeng.liu@intel.com>", "References": "<1526599932-13083-1-git-send-email-changpeng.liu@intel.com>", "Subject": "[dpdk-dev] [PATCH 2/2] examples/vhost_scsi: fix potential buffer\n\toverrun with safe copy API", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>\n---\n examples/vhost_scsi/scsi.c | 23 ++++++++++++-----------\n examples/vhost_scsi/vhost_scsi.c | 5 +++--\n 2 files changed, 15 insertions(+), 13 deletions(-)", "diff": "diff --git a/examples/vhost_scsi/scsi.c b/examples/vhost_scsi/scsi.c\nindex 0c2fa3e..1572098 100644\n--- a/examples/vhost_scsi/scsi.c\n+++ b/examples/vhost_scsi/scsi.c\n@@ -182,8 +182,8 @@\n \t\t\tbreak;\n \t\tcase SPC_VPD_UNIT_SERIAL_NUMBER:\n \t\t\thlen = 4;\n-\t\t\tstrlcpy((char *)vpage->params, bdev->name,\n-\t\t\t\t\tsizeof(vpage->params));\n+\t\t\tvhost_strcpy_pad((char *)vpage->params, bdev->name,\n+\t\t\t\t\tsizeof(vpage->params), ' ');\n \t\t\tvpage->alloc_len = rte_cpu_to_be_16(32);\n \t\t\tbreak;\n \t\tcase SPC_VPD_DEVICE_IDENTIFICATION:\n@@ -217,10 +217,11 @@\n \t\t\tdesig->piv = 1;\n \t\t\tdesig->reserved1 = 0;\n \t\t\tdesig->len = 8 + 16 + 32;\n-\t\t\tstrlcpy((char *)desig->desig, \"INTEL\", 8);\n+\t\t\tvhost_strcpy_pad((char *)desig->desig, \"INTEL\", 8, ' ');\n \t\t\tvhost_strcpy_pad((char *)&desig->desig[8],\n \t\t\t\t\t bdev->product_name, 16, ' ');\n-\t\t\tstrlcpy((char *)&desig->desig[24], bdev->name, 32);\n+\t\t\tvhost_strcpy_pad((char *)&desig->desig[24], bdev->name,\n+\t\t\t\t\t32, ' ');\n \t\t\tlen += sizeof(struct scsi_desig_desc) + 8 + 16 + 32;\n \n \t\t\tbuf += sizeof(struct scsi_desig_desc) + desig->len;\n@@ -277,17 +278,17 @@\n \t\tinqdata->flags3 = 0x2;\n \n \t\t/* T10 VENDOR IDENTIFICATION */\n-\t\tstrlcpy((char *)inqdata->t10_vendor_id, \"INTEL\",\n-\t\t\tsizeof(inqdata->t10_vendor_id));\n+\t\tvhost_strcpy_pad((char *)inqdata->t10_vendor_id, \"INTEL\",\n+\t\t\tsizeof(inqdata->t10_vendor_id), ' ');\n \n \t\t/* PRODUCT IDENTIFICATION */\n-\t\tsnprintf((char *)inqdata->product_id,\n-\t\t\t\tRTE_DIM(inqdata->product_id), \"%s\",\n-\t\t\t\tbdev->product_name);\n+\t\tvhost_strcpy_pad((char *)inqdata->product_id,\n+\t\t\t\tbdev->product_name,\n+\t\t\t\tsizeof(inqdata->product_id), ' ');\n \n \t\t/* PRODUCT REVISION LEVEL */\n-\t\tstrlcpy((char *)inqdata->product_rev, \"0001\",\n-\t\t\tsizeof(inqdata->product_rev));\n+\t\tvhost_strcpy_pad((char *)inqdata->product_rev, \"0001\",\n+\t\t\tsizeof(inqdata->product_rev), ' ');\n \n \t\t/* Standard inquiry data ends here. Only populate\n \t\t * remaining fields if alloc_len indicates enough\ndiff --git a/examples/vhost_scsi/vhost_scsi.c b/examples/vhost_scsi/vhost_scsi.c\nindex a1d542b..4e57462 100644\n--- a/examples/vhost_scsi/vhost_scsi.c\n+++ b/examples/vhost_scsi/vhost_scsi.c\n@@ -183,8 +183,9 @@ static uint64_t gpa_to_vva(int vid, uint64_t gpa, uint64_t *len)\n \tif (!bdev)\n \t\treturn NULL;\n \n-\tstrncpy(bdev->name, bdev_name, sizeof(bdev->name));\n-\tstrncpy(bdev->product_name, bdev_serial, sizeof(bdev->product_name));\n+\tsnprintf(bdev->name, sizeof(bdev->name), \"%s\", bdev_name);\n+\tsnprintf(bdev->product_name, sizeof(bdev->product_name),\n+\t\t\"%s\", bdev_serial);\n \tbdev->blocklen = blk_size;\n \tbdev->blockcnt = blk_cnt;\n \tbdev->write_cache = wce_enable;\n", "prefixes": [ "dpdk-dev", "2/2" ] }{ "id": 40189, "url": "