Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/113824/?format=api
https://patches.dpdk.org/api/patches/113824/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1657259861-75138-1-git-send-email-andy.pei@intel.com/", "project": { "id": 1, "url": "https://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": "<1657259861-75138-1-git-send-email-andy.pei@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1657259861-75138-1-git-send-email-andy.pei@intel.com", "date": "2022-07-08T05:57:41", "name": "vdpa/ifc/base: fix null pointer dereference", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "cd28c2b35527a9850721ab210f95389814f4c429", "submitter": { "id": 1185, "url": "https://patches.dpdk.org/api/people/1185/?format=api", "name": "Pei, Andy", "email": "andy.pei@intel.com" }, "delegate": { "id": 2642, "url": "https://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1657259861-75138-1-git-send-email-andy.pei@intel.com/mbox/", "series": [ { "id": 23936, "url": "https://patches.dpdk.org/api/series/23936/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=23936", "date": "2022-07-08T05:57:41", "name": "vdpa/ifc/base: fix null pointer dereference", "version": 1, "mbox": "https://patches.dpdk.org/series/23936/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/113824/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/113824/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 04D8BA0540;\n\tFri, 8 Jul 2022 07:50:43 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 8E8A0406B4;\n\tFri, 8 Jul 2022 07:50:43 +0200 (CEST)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id 067EC4069D\n for <dev@dpdk.org>; Fri, 8 Jul 2022 07:50:41 +0200 (CEST)", "from orsmga006.jf.intel.com ([10.7.209.51])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 07 Jul 2022 22:50:40 -0700", "from dpdk-dipei.sh.intel.com ([10.67.110.238])\n by orsmga006.jf.intel.com with ESMTP; 07 Jul 2022 22:50:38 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1657259442; x=1688795442;\n h=from:to:cc:subject:date:message-id;\n bh=KMoppmkbMYVbf5zC7FfwEPKfH9JUXOnbKXfeuAeZls8=;\n b=g6EWwM6QzPrLzMdIDHKzoU79/NaYM3ADJnKXd4ZVPpClg2VzfuirUTCz\n py9WzDNVfO+ofjzTwHsiYZ3Dh16HiJwT+tn64CPHwsVWLBz2PxigqKKnS\n ugL3iUXkA9uZOGXiGfWyfSHGvH8x4BP87qyQ4cGbh1vfE3PUjaINFVQL1\n QJPqBOItzCLYWwOfNdIdplfzmmNnFq7pWZ8dKdU5dvy7bGodNa3cxuMBU\n N3MUAVVPJzEj8er6Z1QiauEblmHkzARu+bCnE2bV6vMX6x5dKNAXP5nxW\n XOsEVyU0HTzd9KmDjxVHevXyLTEDcG23ohuUgt3C2t0CKu2XXP4l+UHir A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6400,9594,10401\"; a=\"264611056\"", "E=Sophos;i=\"5.92,254,1650956400\"; d=\"scan'208\";a=\"264611056\"", "E=Sophos;i=\"5.92,254,1650956400\"; d=\"scan'208\";a=\"568817319\"" ], "X-ExtLoop1": "1", "From": "Andy Pei <andy.pei@intel.com>", "To": "dev@dpdk.org", "Cc": "chenbo.xia@intel.com,\n\tmaxime.coquelin@redhat.com,\n\txiao.w.wang@intel.com", "Subject": "[PATCH] vdpa/ifc/base: fix null pointer dereference", "Date": "Fri, 8 Jul 2022 13:57:41 +0800", "Message-Id": "<1657259861-75138-1-git-send-email-andy.pei@intel.com>", "X-Mailer": "git-send-email 1.8.3.1", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Fix null pointer dereference reported in coverity scan.\nOutput some log information when lm_cfg is null.\nMake lm_cfg is not null before operate on lm_cfg.\n\nCoverity issue: 378882\nFixes: d7fe5a2861e7 (\"net/ifc: support live migration\")\n\nSigned-off-by: Andy Pei <andy.pei@intel.com>\n---\n drivers/vdpa/ifc/base/ifcvf.c | 31 ++++++++++++++++++++-----------\n drivers/vdpa/ifc/base/ifcvf_osdep.h | 1 +\n 2 files changed, 21 insertions(+), 11 deletions(-)", "diff": "diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c\nindex 0a9f71a..f1e1474 100644\n--- a/drivers/vdpa/ifc/base/ifcvf.c\n+++ b/drivers/vdpa/ifc/base/ifcvf.c\n@@ -87,6 +87,8 @@\n \t}\n \n \thw->lm_cfg = hw->mem_resource[4].addr;\n+\tif (!hw->lm_cfg)\n+\t\tWARNINGOUT(\"HW support live migration not support!\\n\");\n \n \tif (hw->common_cfg == NULL || hw->notify_base == NULL ||\n \t\t\thw->isr == NULL || hw->dev_cfg == NULL) {\n@@ -218,17 +220,19 @@\n \t\t\t\t&cfg->queue_used_hi);\n \t\tIFCVF_WRITE_REG16(hw->vring[i].size, &cfg->queue_size);\n \n-\t\tif (hw->device_type == IFCVF_BLK)\n-\t\t\t*(u32 *)(lm_cfg + IFCVF_LM_RING_STATE_OFFSET +\n-\t\t\t\ti * IFCVF_LM_CFG_SIZE) =\n-\t\t\t\t(u32)hw->vring[i].last_avail_idx |\n-\t\t\t\t((u32)hw->vring[i].last_used_idx << 16);\n-\t\telse\n-\t\t\t*(u32 *)(lm_cfg + IFCVF_LM_RING_STATE_OFFSET +\n-\t\t\t\t(i / 2) * IFCVF_LM_CFG_SIZE +\n-\t\t\t\t(i % 2) * 4) =\n-\t\t\t\t(u32)hw->vring[i].last_avail_idx |\n-\t\t\t\t((u32)hw->vring[i].last_used_idx << 16);\n+\t\tif (lm_cfg) {\n+\t\t\tif (hw->device_type == IFCVF_BLK)\n+\t\t\t\t*(u32 *)(lm_cfg + IFCVF_LM_RING_STATE_OFFSET +\n+\t\t\t\t\ti * IFCVF_LM_CFG_SIZE) =\n+\t\t\t\t\t(u32)hw->vring[i].last_avail_idx |\n+\t\t\t\t\t((u32)hw->vring[i].last_used_idx << 16);\n+\t\t\telse\n+\t\t\t\t*(u32 *)(lm_cfg + IFCVF_LM_RING_STATE_OFFSET +\n+\t\t\t\t\t(i / 2) * IFCVF_LM_CFG_SIZE +\n+\t\t\t\t\t(i % 2) * 4) =\n+\t\t\t\t\t(u32)hw->vring[i].last_avail_idx |\n+\t\t\t\t\t((u32)hw->vring[i].last_used_idx << 16);\n+\t\t}\n \n \t\tIFCVF_WRITE_REG16(i + 1, &cfg->queue_msix_vector);\n \t\tif (IFCVF_READ_REG16(&cfg->queue_msix_vector) ==\n@@ -320,6 +324,8 @@\n \tu8 *lm_cfg;\n \n \tlm_cfg = hw->lm_cfg;\n+\tif (!lm_cfg)\n+\t\treturn;\n \n \t*(u32 *)(lm_cfg + IFCVF_LM_BASE_ADDR_LOW) =\n \t\tlog_base & IFCVF_32_BIT_MASK;\n@@ -342,6 +348,9 @@\n \tu8 *lm_cfg;\n \n \tlm_cfg = hw->lm_cfg;\n+\tif (!lm_cfg)\n+\t\treturn;\n+\n \t*(u32 *)(lm_cfg + IFCVF_LM_LOGGING_CTRL) = IFCVF_LM_DISABLE;\n }\n \ndiff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h\nindex 6aef25e..8a47fcb 100644\n--- a/drivers/vdpa/ifc/base/ifcvf_osdep.h\n+++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h\n@@ -14,6 +14,7 @@\n #include <rte_log.h>\n #include <rte_io.h>\n \n+#define WARNINGOUT(S, args...) RTE_LOG(WARNING, PMD, S, ##args)\n #define DEBUGOUT(S, args...) RTE_LOG(DEBUG, PMD, S, ##args)\n #define STATIC static\n \n", "prefixes": [] }{ "id": 113824, "url": "