[PATCH v4 2/9] app/test: fix typo in address compare

Stephen Hemminger stephen at networkplumber.org
Thu Nov 21 19:23:23 CET 2024


The first argument of 'memcmp' function was equal to the second argument.
Therefore ASSERT would always be true.

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

Fixes: 92073ef961ee ("bond: unit tests")
Cc: declan.doherty at intel.com
Cc: stable at dpdk.org

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 app/test/test_link_bonding.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 805613d7dd..b752a5ecbf 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -792,7 +792,7 @@ test_set_primary_member(void)
 				&read_mac_addr),
 				"Failed to get mac address (port %d)",
 				test_params->bonding_port_id);
-		TEST_ASSERT_SUCCESS(memcmp(&read_mac_addr, &read_mac_addr,
+		TEST_ASSERT_SUCCESS(memcmp(expected_mac_addr, &read_mac_addr,
 				sizeof(read_mac_addr)),
 				"bonding port mac address not set to that of primary port\n");
 
-- 
2.45.2



More information about the stable mailing list