]> The Tcpdump Group git mirrors - tcpdump/commitdiff
afs/rx: try to suppress "conditional expression is constant" warnings
authorGuy Harris <[email protected]>
Mon, 25 May 2020 23:14:54 +0000 (16:14 -0700)
committerGuy Harris <[email protected]>
Mon, 25 May 2020 23:14:54 +0000 (16:14 -0700)
VECOUT() is always called with a constant argument; make that a
characteristic, and declare the array to be of the proper size, so we
don't need to do the test.

print-rx.c

index 65bc8218d7a582f9176260dfe57321d03f2c6f48..5debd1588dfc7b61e082d67b9d55d78f1e4f3c57 100644 (file)
@@ -59,8 +59,8 @@
 #define ERROR_RX_PORT  7006            /* Doesn't seem to be used */
 #define BOS_RX_PORT    7007
 
-#define AFSNAMEMAX 256
 #define AFSOPAQUEMAX 1024
+#define AFSNAMEMAX 256                 /* Must be >= PRNAMEMAX + 1, VLNAMEMAX + 1, and 32 + 1 */
 #define PRNAMEMAX 64
 #define VLNAMEMAX 65
 #define KANAMEMAX 64
@@ -854,13 +854,12 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh,
 
 /*
  * This is the sickest one of all
+ * MAX is expected to be a constant here
  */
 
 #define VECOUT(MAX) { u_char *sp; \
-                       u_char s[AFSNAMEMAX]; \
+                       u_char s[(MAX) + 1]; \
                        uint32_t k; \
-                       if ((MAX) + 1 > sizeof(s)) \
-                               goto trunc; \
                        ND_TCHECK_LEN(bp, (MAX) * sizeof(uint32_t)); \
                        sp = s; \
                        for (k = 0; k < (MAX); k++) { \