[PATCH v2 02/19] net/cpfl: avoid calling log (printf) with null

Stephen Hemminger stephen at networkplumber.org
Mon Nov 18 19:20:43 CET 2024


The log message would always refer to str variable which
is NULL here. Looks like author intended to print original
parameter.

Link: https://pvs-studio.com/en/blog/posts/cpp/1183/

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/cpfl/cpfl_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index 6f6707a0bd..1817221652 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -1580,7 +1580,7 @@ parse_repr(const char *key __rte_unused, const char *value, void *args)
 		RTE_DIM(eth_da->representor_ports));
 done:
 	if (str == NULL) {
-		PMD_DRV_LOG(ERR, "wrong representor format: %s", str);
+		PMD_DRV_LOG(ERR, "wrong representor format: %s", value);
 		return -1;
 	}
 
-- 
2.45.2



More information about the dev mailing list