]> The Tcpdump Group git mirrors - libpcap/commitdiff
Squelch warnings for negating an unsigned value.
authorGuy Harris <[email protected]>
Fri, 29 Jul 2016 07:31:10 +0000 (00:31 -0700)
committerGuy Harris <[email protected]>
Fri, 29 Jul 2016 07:31:10 +0000 (00:31 -0700)
bpf/net/bpf_filter.c

index 1ce22f4c694ed956b151ff9509539dc022e3aa7f..01a1b64e7197193023628eeebb87e6f7e0ef3565 100644 (file)
@@ -579,7 +579,12 @@ bpf_filter_with_aux_data(pc, p, wirelen, buflen, aux_data)
                        continue;
 
                case BPF_ALU|BPF_NEG:
-                       A = -A;
+                       /*
+                        * Most BPF arithmetic is unsigned, but negation
+                        * can't be unsigned; throw some casts to
+                        * specify what we're trying to do.
+                        */
+                       A = (u_int32)(-(int32)A);
                        continue;
 
                case BPF_MISC|BPF_TAX: