Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/134293/?format=api
http://patchwork.dpdk.org/api/patches/134293/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20231114112407.3496460-15-huangdengdui@huawei.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20231114112407.3496460-15-huangdengdui@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20231114112407.3496460-15-huangdengdui@huawei.com", "date": "2023-11-14T11:23:38", "name": "[v2,14/43] bus/pci: use rte strerror", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "edcb9068ec51424010cd7eb209b80eb86f642aa1", "submitter": { "id": 3066, "url": "http://patchwork.dpdk.org/api/people/3066/?format=api", "name": "huangdengdui", "email": "huangdengdui@huawei.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20231114112407.3496460-15-huangdengdui@huawei.com/mbox/", "series": [ { "id": 30292, "url": "http://patchwork.dpdk.org/api/series/30292/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=30292", "date": "2023-11-14T11:23:25", "name": "replace strerror", "version": 2, "mbox": "http://patchwork.dpdk.org/series/30292/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/134293/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/134293/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 A745843329;\n\tTue, 14 Nov 2023 12:25:39 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 16A3E40DFD;\n\tTue, 14 Nov 2023 12:24:28 +0100 (CET)", "from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189])\n by mails.dpdk.org (Postfix) with ESMTP id 44BBC402B2\n for <dev@dpdk.org>; Tue, 14 Nov 2023 12:24:11 +0100 (CET)", "from dggpeml500011.china.huawei.com (unknown [172.30.72.57])\n by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SV3jM1pSCzMmnP;\n Tue, 14 Nov 2023 19:19:35 +0800 (CST)", "from localhost.huawei.com (10.50.165.33) by\n dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.31; Tue, 14 Nov 2023 19:24:10 +0800" ], "From": "Dengdui Huang <huangdengdui@huawei.com>", "To": "<dev@dpdk.org>", "CC": "<ferruh.yigit@amd.com>, <stephen@networkplumber.org>,\n <lihuisong@huawei.com>, <fengchengwen@huawei.com>, <liuyonglong@huawei.com>", "Subject": "[PATCH v2 14/43] bus/pci: use rte strerror", "Date": "Tue, 14 Nov 2023 19:23:38 +0800", "Message-ID": "<20231114112407.3496460-15-huangdengdui@huawei.com>", "X-Mailer": "git-send-email 2.33.0", "In-Reply-To": "<20231114112407.3496460-1-huangdengdui@huawei.com>", "References": "<20231114082539.1858594-44-huangdengdui@huawei.com>\n <20231114112407.3496460-1-huangdengdui@huawei.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Originating-IP": "[10.50.165.33]", "X-ClientProxiedBy": "dggems705-chm.china.huawei.com (10.3.19.182) To\n dggpeml500011.china.huawei.com (7.185.36.84)", "X-CFilter-Loop": "Reflected", "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": "The function strerror() is insecure in a multi-thread environment.\nThis patch uses rte_strerror() to replace it.\n\nCc: stable@dpdk.org\n\nSigned-off-by: Dengdui Huang <huangdengdui@huawei.com>\nAcked-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n drivers/bus/pci/bsd/pci.c | 8 ++++----\n drivers/bus/pci/linux/pci.c | 7 ++++---\n drivers/bus/pci/linux/pci_uio.c | 23 ++++++++++++-----------\n drivers/bus/pci/linux/pci_vfio.c | 23 ++++++++++++-----------\n drivers/bus/pci/pci_common_uio.c | 3 ++-\n 5 files changed, 34 insertions(+), 30 deletions(-)", "diff": "diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c\nindex 27f12590d4..ce08372931 100644\n--- a/drivers/bus/pci/bsd/pci.c\n+++ b/drivers/bus/pci/bsd/pci.c\n@@ -125,7 +125,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,\n \n \tif (rte_intr_fd_get(dev->intr_handle) < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot open %s: %s\\n\",\n-\t\t\tdevname, strerror(errno));\n+\t\t\tdevname, rte_strerror(errno));\n \t\tgoto error;\n \t}\n \n@@ -169,7 +169,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,\n \tmaps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);\n \tif (maps[map_idx].path == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot allocate memory for path: %s\\n\",\n-\t\t\t\tstrerror(errno));\n+\t\t\t\trte_strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -179,7 +179,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,\n \tfd = open(devname, O_RDWR);\n \tif (fd < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot open %s: %s\\n\",\n-\t\t\t\tdevname, strerror(errno));\n+\t\t\t\tdevname, rte_strerror(errno));\n \t\tgoto error;\n \t}\n \n@@ -353,7 +353,7 @@ rte_pci_scan(void)\n \t\tunsigned i;\n \t\tif (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {\n \t\t\tRTE_LOG(ERR, EAL, \"%s(): error with ioctl on /dev/pci: %s\\n\",\n-\t\t\t\t\t__func__, strerror(errno));\n+\t\t\t\t\t__func__, rte_strerror(errno));\n \t\t\tgoto error;\n \t\t}\n \ndiff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c\nindex 3d237398d9..7d870b43d2 100644\n--- a/drivers/bus/pci/linux/pci.c\n+++ b/drivers/bus/pci/linux/pci.c\n@@ -12,6 +12,7 @@\n #include <rte_devargs.h>\n #include <rte_memcpy.h>\n #include <rte_vfio.h>\n+#include <rte_errno.h>\n \n #include \"eal_filesystem.h\"\n \n@@ -455,7 +456,7 @@ rte_pci_scan(void)\n \tdir = opendir(rte_pci_get_sysfs_path());\n \tif (dir == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"%s(): opendir failed: %s\\n\",\n-\t\t\t__func__, strerror(errno));\n+\t\t\t__func__, rte_strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -506,7 +507,7 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev)\n \t\t\treturn true;\n \n \t\tRTE_LOG(ERR, EAL, \"%s(): can't open %s: %s\\n\",\n-\t\t\t__func__, filename, strerror(errno));\n+\t\t\t__func__, filename, rte_strerror(errno));\n \t\treturn false;\n \t}\n \n@@ -557,7 +558,7 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)\n \n \tif (fp == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"%s(): can't open %s: %s\\n\",\n-\t\t\t__func__, filename, strerror(errno));\n+\t\t\t__func__, filename, rte_strerror(errno));\n \t\treturn ret;\n \t}\n \ndiff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c\nindex 97d740dfe5..2ee0179ea2 100644\n--- a/drivers/bus/pci/linux/pci_uio.c\n+++ b/drivers/bus/pci/linux/pci_uio.c\n@@ -21,6 +21,7 @@\n #include <rte_bus_pci.h>\n #include <rte_common.h>\n #include <rte_malloc.h>\n+#include <rte_errno.h>\n \n #include \"eal_filesystem.h\"\n #include \"pci_init.h\"\n@@ -111,7 +112,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)\n \tret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev);\n \tif (ret != 0) {\n \t\tRTE_LOG(ERR, EAL, \"%s(): mknod() failed %s\\n\",\n-\t\t\t__func__, strerror(errno));\n+\t\t\t__func__, rte_strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -241,7 +242,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,\n \tfd = open(devname, O_RDWR);\n \tif (fd < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot open %s: %s\\n\",\n-\t\t\tdevname, strerror(errno));\n+\t\t\tdevname, rte_strerror(errno));\n \t\tgoto error;\n \t}\n \n@@ -254,7 +255,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,\n \tuio_cfg_fd = open(cfgname, O_RDWR);\n \tif (uio_cfg_fd < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot open %s: %s\\n\",\n-\t\t\tcfgname, strerror(errno));\n+\t\t\tcfgname, rte_strerror(errno));\n \t\tgoto error;\n \t}\n \n@@ -314,7 +315,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,\n \tmaps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0);\n \tif (maps[map_idx].path == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot allocate memory for path: %s\\n\",\n-\t\t\t\tstrerror(errno));\n+\t\t\t\trte_strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -348,7 +349,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,\n \t\tfd = open(devname, O_RDWR);\n \t\tif (fd < 0) {\n \t\t\tRTE_LOG(ERR, EAL, \"Cannot open %s: %s\\n\",\n-\t\t\t\tdevname, strerror(errno));\n+\t\t\t\tdevname, rte_strerror(errno));\n \t\t\tgoto error;\n \t\t}\n \t}\n@@ -404,7 +405,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,\n \tf = fopen(filename, \"r\");\n \tif (f == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"%s(): Cannot open sysfs resource: %s\\n\",\n-\t\t\t__func__, strerror(errno));\n+\t\t\t__func__, rte_strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -446,7 +447,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,\n \t\tint uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0);\n \t\tif (uio_num < 0) {\n \t\t\tRTE_LOG(ERR, EAL, \"cannot open %s: %s\\n\",\n-\t\t\t\tdirname, strerror(errno));\n+\t\t\t\tdirname, rte_strerror(errno));\n \t\t\tgoto error;\n \t\t}\n \n@@ -454,7 +455,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,\n \t\tfd = open(filename, O_RDWR);\n \t\tif (fd < 0) {\n \t\t\tRTE_LOG(ERR, EAL, \"Cannot open %s: %s\\n\",\n-\t\t\t\tfilename, strerror(errno));\n+\t\t\t\tfilename, rte_strerror(errno));\n \t\t\tgoto error;\n \t\t}\n \t\tif (rte_intr_fd_set(dev->intr_handle, fd))\n@@ -494,7 +495,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,\n \tf = fopen(filename, \"r\");\n \tif (f == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot open sysfs resource: %s\\n\",\n-\t\t\tstrerror(errno));\n+\t\t\trte_strerror(errno));\n \t\treturn -1;\n \t}\n \tfor (i = 0; i < bar + 1; i++) {\n@@ -518,7 +519,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,\n \tfd = open(filename, O_RDWR);\n \tif (fd < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot open %s: %s\\n\", filename,\n-\t\t\tstrerror(errno));\n+\t\t\trte_strerror(errno));\n \t\tgoto error;\n \t}\n \taddr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE,\n@@ -526,7 +527,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,\n \tclose(fd);\n \tif (addr == MAP_FAILED) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot mmap IO port resource: %s\\n\",\n-\t\t\tstrerror(errno));\n+\t\t\trte_strerror(errno));\n \t\tgoto error;\n \t}\n \ndiff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c\nindex 3f3201daf2..671b0f36bc 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -21,6 +21,7 @@\n #include <bus_driver.h>\n #include <rte_spinlock.h>\n #include <rte_tailq.h>\n+#include <rte_errno.h>\n \n #include \"eal_filesystem.h\"\n \n@@ -225,7 +226,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)\n \t\tret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);\n \t\tif (ret < 0) {\n \t\t\tRTE_LOG(ERR, EAL, \"Cannot get VFIO IRQ info, error \"\n-\t\t\t\t\t\"%i (%s)\\n\", errno, strerror(errno));\n+\t\t\t\t\t\"%i (%s)\\n\", errno, rte_strerror(errno));\n \t\t\treturn -1;\n \t\t}\n \n@@ -252,7 +253,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)\n \t\tfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);\n \t\tif (fd < 0) {\n \t\t\tRTE_LOG(ERR, EAL, \"Cannot set up eventfd, error \"\n-\t\t\t\t\t\"%i (%s)\\n\", errno, strerror(errno));\n+\t\t\t\t\t\"%i (%s)\\n\", errno, rte_strerror(errno));\n \t\t\treturn -1;\n \t\t}\n \n@@ -336,7 +337,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)\n \tfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);\n \tif (fd < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot set up eventfd, error %i (%s)\\n\",\n-\t\t\terrno, strerror(errno));\n+\t\t\terrno, rte_strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -460,7 +461,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)\n \t */\n \tif (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {\n \t\tRTE_LOG(ERR, EAL, \"Unable to reset device! Error: %d (%s)\\n\",\n-\t\t\t\terrno, strerror(errno));\n+\t\t\t\terrno, rte_strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -742,7 +743,7 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int vfio_dev_fd,\n \t\tret = pci_vfio_get_region_info(vfio_dev_fd, ®, i);\n \t\tif (ret < 0) {\n \t\t\tRTE_LOG(DEBUG, EAL, \"%s cannot get device region info error %i (%s)\\n\",\n-\t\t\t\tdev->name, errno, strerror(errno));\n+\t\t\t\tdev->name, errno, rte_strerror(errno));\n \t\t\treturn -1;\n \t\t}\n \n@@ -811,7 +812,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)\n \t\tVFIO_PCI_CONFIG_REGION_INDEX);\n \tif (ret < 0) {\n \t\tRTE_LOG(ERR, EAL, \"%s cannot get device region info error %i (%s)\\n\",\n-\t\t\tdev->name, errno, strerror(errno));\n+\t\t\tdev->name, errno, rte_strerror(errno));\n \t\tgoto err_vfio_res;\n \t}\n \tpdev->region[VFIO_PCI_CONFIG_REGION_INDEX].size = reg->size;\n@@ -851,7 +852,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)\n \t\tif (ret < 0) {\n \t\t\tRTE_LOG(ERR, EAL,\n \t\t\t\t\"%s cannot get device region info error \"\n-\t\t\t\t\"%i (%s)\\n\", pci_addr, errno, strerror(errno));\n+\t\t\t\t\"%i (%s)\\n\", pci_addr, errno, rte_strerror(errno));\n \t\t\tgoto err_map;\n \t\t}\n \n@@ -914,7 +915,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)\n \t\t\tret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, 0);\n \t\t\tif (ret < 0) {\n \t\t\t\tRTE_LOG(ERR, EAL, \"%s sparse mapping BAR%i failed: %s\\n\",\n-\t\t\t\t\t\tpci_addr, i, strerror(errno));\n+\t\t\t\t\t\tpci_addr, i, rte_strerror(errno));\n \t\t\t\tfree(reg);\n \t\t\t\tgoto err_map;\n \t\t\t}\n@@ -922,7 +923,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)\n \t\t\tret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 0);\n \t\t\tif (ret < 0) {\n \t\t\t\tRTE_LOG(ERR, EAL, \"%s mapping BAR%i failed: %s\\n\",\n-\t\t\t\t\t\tpci_addr, i, strerror(errno));\n+\t\t\t\t\t\tpci_addr, i, rte_strerror(errno));\n \t\t\t\tfree(reg);\n \t\t\t\tgoto err_map;\n \t\t\t}\n@@ -1019,14 +1020,14 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)\n \t\t\tret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);\n \t\t\tif (ret < 0) {\n \t\t\t\tRTE_LOG(ERR, EAL, \"%s sparse mapping BAR%i failed: %s\\n\",\n-\t\t\t\t\t\tpci_addr, i, strerror(errno));\n+\t\t\t\t\t\tpci_addr, i, rte_strerror(errno));\n \t\t\t\tgoto err_vfio_dev_fd;\n \t\t\t}\n \t\t} else {\n \t\t\tret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);\n \t\t\tif (ret < 0) {\n \t\t\t\tRTE_LOG(ERR, EAL, \"%s mapping BAR%i failed: %s\\n\",\n-\t\t\t\t\t\tpci_addr, i, strerror(errno));\n+\t\t\t\t\t\tpci_addr, i, rte_strerror(errno));\n \t\t\t\tgoto err_vfio_dev_fd;\n \t\t\t}\n \t\t}\ndiff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c\nindex 76c661f054..5d59a90b33 100644\n--- a/drivers/bus/pci/pci_common_uio.c\n+++ b/drivers/bus/pci/pci_common_uio.c\n@@ -15,6 +15,7 @@\n #include <rte_tailq.h>\n #include <rte_log.h>\n #include <rte_malloc.h>\n+#include <rte_errno.h>\n \n #include \"private.h\"\n \n@@ -44,7 +45,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)\n \t\t\tfd = open(uio_res->maps[i].path, O_RDWR);\n \t\t\tif (fd < 0) {\n \t\t\t\tRTE_LOG(ERR, EAL, \"Cannot open %s: %s\\n\",\n-\t\t\t\t\tuio_res->maps[i].path, strerror(errno));\n+\t\t\t\t\tuio_res->maps[i].path, rte_strerror(errno));\n \t\t\t\treturn -1;\n \t\t\t}\n \n", "prefixes": [ "v2", "14/43" ] }{ "id": 134293, "url": "