[Swan-dev] possible ip_range_check.c bug caught by Coverity Scan

D. Hugh Redelmeier hugh at mimosa.com
Tue May 4 04:45:14 UTC 2021


| From: scan-admin at coverity.com

| ________________________________________________________________________________________________________
| *** CID 1504581:  Incorrect expression  (COPY_PASTE_ERROR)
| /testing/programs/ipcheck/ip_range_check.c: 395 in check_range_op_range()
| 389     				FAIL("ttorange(%s) failed: %s", t->R, oops); \
| 390     			}						\
| 391     		} else {						\
| 392     			l = unset_range;				\
| 393     		}
| 394     		TT(l);
| >>>     CID 1504581:  Incorrect expression  (COPY_PASTE_ERROR)
| >>>     "l" in "l = unset_range" looks like a copy-paste error.
| 395     		TT(r);
| 396     #undef TT
| 397     
| 398     #define T(OP,L,R)							\
| 399     		{							\
| 400     			bool cond = OP(L,R);				\
| 
| ** CID 1504580:    (UNREACHABLE)
| /testing/programs/ipcheck/ip_address_check.c: 396 in check_addresses_to()
| /testing/programs/ipcheck/ip_address_check.c: 403 in check_addresses_to()

I'm not sure what it is complaining about but I think it might be
right.

Cagney: does this fix look correct?

diff --git a/testing/programs/ipcheck/ip_range_check.c b/testing/programs/ipcheck/ip_range_check.c
index 256cf76c70..9f9a27db58 100644
--- a/testing/programs/ipcheck/ip_range_check.c
+++ b/testing/programs/ipcheck/ip_range_check.c
@@ -389,7 +389,7 @@ static void check_range_op_range(void)
 				FAIL("ttorange(%s) failed: %s", t->R, oops); \
 			}						\
 		} else {						\
-			l = unset_range;				\
+			R = unset_range;				\
 		}
 		TT(l);
 		TT(r);


More information about the Swan-dev mailing list