Skip to contentSkip to conversation

eal: don't log uninitialized string

PATCH In review Andrew Boyer 3 participants 4 messages Dec 11, 2020 – Feb 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: don't log uninitialized string

Our Coverity scan pointed out that path[] is never initialized. The official DPDK Coverity has not reported this so there is no public CID for it.

Fixes c44d09811b40 ("eal: add shared indexed file-backed array")
---
 lib/librte_eal/common/eal_common_fbarray.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/librte_eal/common/eal_common_fbarray.c +1 -2
index 1220e2bae..6ce89af83 100644
@@ -83,11 +83,10 @@ get_used_mask(void *data, unsigned int elt_sz, unsigned int len)
 static int
 resize_and_map(int fd, void *addr, size_t len)
 {
-	char path[PATH_MAX];
 	void *map_addr;
 
 	if (eal_file_truncate(fd, len)) {
-		RTE_LOG(ERR, EAL, "Cannot truncate %s\n", path);
+		RTE_LOG(ERR, EAL, "Cannot truncate fd %d\n", fd);
 		return -1;
 	}
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Andrew Boyer
Sent: Friday, December 11, 2020 5:06 PM
To: [email protected]
Cc: Andrew Boyer <[email protected]>; Burakov, Anatoly <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] eal: don't log uninitialized string

Our Coverity scan pointed out that path[] is never initialized. The official DPDK Coverity has not reported this so there is no public CID for it.

I double checked and I can confirm that this wasn't picked up by any of the public scans, even though 4 other issues in that file were. So thanks for the fix.

#2 lore raw
In reply to Andrew Boyer
Quoted 19 lines · Andrew Boyer

Our Coverity scan pointed out that path[] is never initialized. The official DPDK Coverity has not reported this so there is no public CID for it.

Fixes c44d09811b40 ("eal: add shared indexed file-backed array")
---
 lib/librte_eal/common/eal_common_fbarray.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/librte_eal/common/eal_common_fbarray.c +0 -0
index 1220e2bae..6ce89af83 100644

lib/librte_eal/common/eal_common_fbarray.c get_used_mask(void *data, unsigned int elt_sz, unsigned int len) · line 89

Quoted 9 lines
lib/librte_eal/common/eal_common_fbarray.c +1 -2
@@ -83,11 +83,10 @@ get_used_mask(void *data, unsigned int elt_sz, unsigned int len)
 static int
 resize_and_map(int fd, void *addr, size_t len)
 {
-       char path[PATH_MAX];
        void *map_addr;
 
        if (eal_file_truncate(fd, len)) {
-               RTE_LOG(ERR, EAL, "Cannot truncate %s\n", path);
+               RTE_LOG(ERR, EAL, "Cannot truncate fd %d\n", fd);

Logging a fd number won't help much, but I guess this was not really helpful with path[] either :-).
If we keep this log, I would move it to the callers of the functions, where the filename is available.

Signature · 1 line
David Marchand
#3 lore raw
Quoted 29 lines · David Marchand
Quoted 25 lines · On Fri, Dec 11, 2020 at 6:07 PM Andrew Boyer <[email protected]…

Our Coverity scan pointed out that path[] is never initialized. The official DPDK Coverity has not reported this so there is no public CID for it.

Fixes c44d09811b40 ("eal: add shared indexed file-backed array")

---
lib/librte_eal/common/eal_common_fbarray.c | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)
lib/librte_eal/common/eal_common_fbarray.c +0 -0
index 1220e2bae..6ce89af83 100644
@@ -83,11 +83,10 @@ get_used_mask(void *data, unsigned int elt_sz, unsigned int len)

static int
resize_and_map(int fd, void *addr, size_t len)
{

-       char path[PATH_MAX];
       void *map_addr;
Quoted 12 lines

lib/librte_eal/common/eal_common_fbarray.c get_used_mask(void *data, unsigned int elt_sz, unsigned int len) · line 89

Quoted 3 lines
       if (eal_file_truncate(fd, len)) {
lib/librte_eal/common/eal_common_fbarray.c +1 -1
-               RTE_LOG(ERR, EAL, "Cannot truncate %s\n", path);
+               RTE_LOG(ERR, EAL, "Cannot truncate fd %d\n", fd);

Logging a fd number won't help much, but I guess this was not really helpful with path[] either :-).
If we keep this log, I would move it to the callers of the functions, where the filename is available.

Signature · 1 line
David Marchand

Can this be taken for 21.02? I realize the log isn’t that useful, but it doesn’t seem worth it (to me at least) to do much more work on it.

-Andrew