aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Kelsey <pkelsey@FreeBSD.org>2015-07-08 21:32:57 +0000
committerPatrick Kelsey <pkelsey@FreeBSD.org>2015-07-08 21:32:57 +0000
commit1bf4ba1024df1c302debe8156a60a9dfafb149ee (patch)
tree253d845050a8d3ced3912d2a864b007e48c23d47
parent7041091186ddb72670e3e2d8254859ed31d3f2e6 (diff)
downloadsrc-1bf4ba1024df1c302debe8156a60a9dfafb149ee.tar.gz
src-1bf4ba1024df1c302debe8156a60a9dfafb149ee.zip
Merge upstream fix to eliminate build-breaking gcc warnings of no
importance. commit: cab33b7a0acba7d2268a23c4383be6167106e549 Update ND_TTEST2 to fix issue 443 Add IS_NOT_NEGATIVE macro. Avoid these warnings: - comparison of unsigned expression >= 0 is always true [-Wtype-limits], - comparison is always true due to limited range of data type [-Wtype-limits]. Approved by: jmallett (mentor)
Notes
Notes: svn path=/vendor/tcpdump/dist/; revision=285292
-rw-r--r--netdissect.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/netdissect.h b/netdissect.h
index d507f580aa12..e54c01acd98a 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -270,8 +270,11 @@ struct netdissect_options {
*
* http://www.kb.cert.org/vuls/id/162289
*/
+
+#define IS_NOT_NEGATIVE(x) (((x) > 0) || ((x) == 0))
+
#define ND_TTEST2(var, l) \
- ((l) >= 0 && \
+ (IS_NOT_NEGATIVE(l) && \
((uintptr_t)ndo->ndo_snapend - (l) <= (uintptr_t)ndo->ndo_snapend && \
(uintptr_t)&(var) <= (uintptr_t)ndo->ndo_snapend - (l)))