[dpdk-stable] patch 'raw/ifpga: terminate string filled by readlink with null' has been queued to stable release 19.11.6

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Nov 9 19:41:00 CET 2020


Hi,

FYI, your patch has been queued to stable release 19.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/11/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/6bf53dde34211bc779dd4d69fa02775274073309

Thanks.

Luca Boccassi

---
>From 6bf53dde34211bc779dd4d69fa02775274073309 Mon Sep 17 00:00:00 2001
From: Wei Huang <wei.huang at intel.com>
Date: Fri, 30 Oct 2020 03:35:06 -0400
Subject: [PATCH] raw/ifpga: terminate string filled by readlink with null

[ upstream commit 5a906909af93c46941bf0c56a97af8f0b279d1d4 ]

readlink() does not terminate string, add a null character at the end
of the string if readlink() succeeds.

Coverity issue: 362820
Fixes: 9c006c45d0c5 ("raw/ifpga: scan PCIe BDF device tree")

Signed-off-by: Wei Huang <wei.huang at intel.com>
Acked-by: Qi Zhang <qi.z.zhang at intel.com>
---
 drivers/raw/ifpga/ifpga_rawdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 7bfdde650d..05b6de6312 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -237,8 +237,9 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev,
 	memset(link, 0, sizeof(link));
 	memset(link1, 0, sizeof(link1));
 	ret = readlink(path, link, (sizeof(link)-1));
-	if (ret == -1)
+	if ((ret < 0) || ((unsigned int)ret > (sizeof(link)-1)))
 		return -1;
+	link[ret] = 0;   /* terminate string with null character */
 	strlcpy(link1, link, sizeof(link1));
 	memset(ifpga_dev->parent_bdf, 0, 16);
 	point = strlen(link);
-- 
2.27.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-11-09 18:40:13.862002456 +0000
+++ 0072-raw-ifpga-terminate-string-filled-by-readlink-with-n.patch	2020-11-09 18:40:11.215312589 +0000
@@ -1 +1 @@
-From 5a906909af93c46941bf0c56a97af8f0b279d1d4 Mon Sep 17 00:00:00 2001
+From 6bf53dde34211bc779dd4d69fa02775274073309 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 5a906909af93c46941bf0c56a97af8f0b279d1d4 ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index 0385514cdc..f9de1677b4 100644
+index 7bfdde650d..05b6de6312 100644
@@ -23 +24 @@
-@@ -230,8 +230,9 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev,
+@@ -237,8 +237,9 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev,


More information about the stable mailing list