Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/38407/?format=api
https://patches.dpdk.org/api/patches/38407/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/822a2658f3dd71c6d4d71968dc1114528d8df5cc.1524047073.git.anatoly.burakov@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": "<822a2658f3dd71c6d4d71968dc1114528d8df5cc.1524047073.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/822a2658f3dd71c6d4d71968dc1114528d8df5cc.1524047073.git.anatoly.burakov@intel.com", "date": "2018-04-18T10:37:42", "name": "[dpdk-dev,v2,09/10] mem: fix negative return value", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "0398b32a5f7f927b4f01a9805ee015af7b82b481", "submitter": { "id": 4, "url": "https://patches.dpdk.org/api/people/4/?format=api", "name": "Burakov, Anatoly", "email": "anatoly.burakov@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/822a2658f3dd71c6d4d71968dc1114528d8df5cc.1524047073.git.anatoly.burakov@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/38407/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/38407/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 B4CF3AAAE;\n\tWed, 18 Apr 2018 12:38:17 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 54CFF8D35\n\tfor <dev@dpdk.org>; Wed, 18 Apr 2018 12:37:49 +0200 (CEST)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t18 Apr 2018 03:37:46 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga005.fm.intel.com with ESMTP; 18 Apr 2018 03:37:45 -0700", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw3IAbicK018457; Wed, 18 Apr 2018 11:37:44 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w3IAbi9x015814;\n\tWed, 18 Apr 2018 11:37:44 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w3IAbiZh015806;\n\tWed, 18 Apr 2018 11:37:44 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.48,464,1517904000\"; d=\"scan'208\";a=\"221365230\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "thomas@monjalon.net, anatoly.burakov@intel.com", "Date": "Wed, 18 Apr 2018 11:37:42 +0100", "Message-Id": "<822a2658f3dd71c6d4d71968dc1114528d8df5cc.1524047073.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1524047073.git.anatoly.burakov@intel.com>", "<cover.1524047073.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1524047073.git.anatoly.burakov@intel.com>", "<cover.1523977588.git.anatoly.burakov@intel.com>\n\t<cover.1524047073.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v2 09/10] mem: fix negative return value", "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": "Although unlikely during normal operation, rte_socket_id_by_idx()\nmay return a negative value, which would've caused an out-of-bounds\nread. Fix it by making socket ID signed, and check for negative\nreturn.\n\nCoverity issue: 272577\nCoverity issue: 272578\n\nFixes: 66cc45e293ed (\"mem: replace memseg with memseg lists\")\nCc: anatoly.burakov@intel.com\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/eal_common_memory.c | 17 ++++++++++++++---\n 1 file changed, 14 insertions(+), 3 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c\nindex 24a9ed5..68fc70e 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -205,7 +205,8 @@ memseg_primary_init_32(void)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \tint active_sockets, hpi_idx, msl_idx = 0;\n-\tunsigned int socket_id, i;\n+\tunsigned int i;\n+\tint socket_id;\n \tstruct rte_memseg_list *msl;\n \tuint64_t extra_mem_per_socket, total_extra_mem, total_requested_mem;\n \tuint64_t max_mem;\n@@ -238,6 +239,11 @@ memseg_primary_init_32(void)\n \t\t\tuint64_t mem;\n \n \t\t\tsocket_id = rte_socket_id_by_idx(i);\n+\t\t\tif (socket_id < 0) {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"Invalid socket index: %u\\n\",\n+\t\t\t\t\t\ti);\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tmem = internal_config.socket_mem[socket_id];\n \n \t\t\tif (mem == 0)\n@@ -281,6 +287,10 @@ memseg_primary_init_32(void)\n \t\tbool skip;\n \n \t\tsocket_id = rte_socket_id_by_idx(i);\n+\t\tif (socket_id < 0) {\n+\t\t\tRTE_LOG(ERR, EAL, \"Invalid socket index: %u\\n\", i);\n+\t\t\tcontinue;\n+\t\t}\n \n #ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES\n \t\tif (socket_id > 0)\n@@ -294,10 +304,11 @@ memseg_primary_init_32(void)\n \t\t * socket, and this is not master lcore\n \t\t */\n \t\tmaster_lcore_socket = rte_lcore_to_socket_id(cfg->master_lcore);\n-\t\tskip |= active_sockets == 0 && socket_id != master_lcore_socket;\n+\t\tskip |= active_sockets == 0 &&\n+\t\t\t\t(unsigned int)socket_id != master_lcore_socket;\n \n \t\tif (skip) {\n-\t\t\tRTE_LOG(DEBUG, EAL, \"Will not preallocate memory on socket %u\\n\",\n+\t\t\tRTE_LOG(DEBUG, EAL, \"Will not preallocate memory on socket %i\\n\",\n \t\t\t\t\tsocket_id);\n \t\t\tcontinue;\n \t\t}\n", "prefixes": [ "dpdk-dev", "v2", "09/10" ] }{ "id": 38407, "url": "