[PATCH v3 03/10] app/test: fix paren typo

Stephen Hemminger stephen at networkplumber.org
Fri Nov 15 21:06:47 CET 2024


The parenthesis were in the wrong place so that comparison
took precedence over assignment in handling IPv6 extension
headers.  Break up the loop condition to avoid the problem.

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

Fixes: 15ccc647526e ("test/security: test inline reassembly with multi-segment")
Cc: ndabilpuram at marvell.com
Cc: stable at dpdk.org

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 app/test/test_security_inline_proto_vectors.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/app/test/test_security_inline_proto_vectors.h b/app/test/test_security_inline_proto_vectors.h
index b3d724bac6..86dfa54777 100644
--- a/app/test/test_security_inline_proto_vectors.h
+++ b/app/test/test_security_inline_proto_vectors.h
@@ -519,10 +519,12 @@ test_vector_payload_populate(struct ip_reassembly_test_packet *pkt,
 			if (extra_data_sum) {
 				proto = hdr->proto;
 				p += sizeof(struct rte_ipv6_hdr);
-				while (proto != IPPROTO_FRAGMENT &&
-				       (proto = rte_ipv6_get_next_ext(p, proto, &ext_len) >= 0))
+				while (proto != IPPROTO_FRAGMENT) {
+					proto = rte_ipv6_get_next_ext(p, proto, &ext_len);
+					if (proto < 0)
+						break;
 					p += ext_len;
-
+				}
 				/* Found fragment header, update the frag offset */
 				if (proto == IPPROTO_FRAGMENT) {
 					frag_ext = (struct rte_ipv6_fragment_ext *)p;
-- 
2.45.2



More information about the stable mailing list