net/nfp: fix one memory access problem

Message ID 20231008070809.1582669-1-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/nfp: fix one memory access problem |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-testing warning apply patch failure

Commit Message

Chaoyong He Oct. 8, 2023, 7:08 a.m. UTC
  The initial logic do not give a value to the out parameter in the
abnormal logic, which cause an local variable uninitialized problem.

Fixes: 3d6811281392 ("net/nfp: add infrastructure for conntrack flow merge")
Cc: chaoyong.he@corigine.com

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/flower/nfp_conntrack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Oct. 9, 2023, 9:06 a.m. UTC | #1
On 10/8/2023 8:08 AM, Chaoyong He wrote:
> The initial logic do not give a value to the out parameter in the
> abnormal logic, which cause an local variable uninitialized problem.
> 
> Fixes: 3d6811281392 ("net/nfp: add infrastructure for conntrack flow merge")
> Cc: chaoyong.he@corigine.com
> 
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> 

   Tested-by: Daxue Gao <daxuex.gao@intel.com>


Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>


Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/nfp/flower/nfp_conntrack.c b/drivers/net/nfp/flower/nfp_conntrack.c
index aacd4d7dd3..7b84b12546 100644
--- a/drivers/net/nfp/flower/nfp_conntrack.c
+++ b/drivers/net/nfp/flower/nfp_conntrack.c
@@ -332,6 +332,7 @@  nfp_flow_item_conf_size_get(enum rte_flow_item_type type,
 		break;
 	default:
 		PMD_DRV_LOG(ERR, "Unsupported item type: %d", type);
+		*size = 0;
 		return false;
 	}
 
@@ -1265,9 +1266,9 @@  nfp_ct_merge_item_real(const struct rte_flow_item *item_src,
 		struct rte_flow_item *item_dst)
 {
 	uint32_t i;
-	size_t size;
 	char *key_dst;
 	char *mask_dst;
+	size_t size = 0;
 	const char *key_src;
 	const char *mask_src;