]> err.no Git - linux-2.6/commitdiff
[NETFILTER]: nf_conntrack_h323: check range first in sequence extension
authorJing Min Zhao <zhaojingmin@vivecode.com>
Sun, 8 Jul 2007 05:13:17 +0000 (22:13 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 11 Jul 2007 05:16:54 +0000 (22:16 -0700)
Check range before checking STOP flag. This optimization may save a
nanosecond or less :)

Signed-off-by: Jing Min Zhao <zhaojingmin@vivecode.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/nf_conntrack_h323_asn1.c

index 6b7eaa019d4c84883e62bf2cbce2e7d1afbe702b..a869403b229419562f6749b347b6ad7f8955e220 100644 (file)
@@ -555,15 +555,6 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level)
 
        /* Decode the extension components */
        for (opt = 0; opt < bmp2_len; opt++, i++, son++) {
-               if (i < f->ub && son->attr & STOP) {
-                       PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
-                             son->name);
-                       return H323_ERROR_STOP;
-               }
-
-               if (!((0x80000000 >> opt) & bmp2))      /* Not present */
-                       continue;
-
                /* Check Range */
                if (i >= f->ub) {       /* Newer Version? */
                        CHECK_BOUND(bs, 2);
@@ -573,6 +564,15 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level)
                        continue;
                }
 
+               if (son->attr & STOP) {
+                       PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
+                             son->name);
+                       return H323_ERROR_STOP;
+               }
+
+               if (!((0x80000000 >> opt) & bmp2))      /* Not present */
+                       continue;
+
                CHECK_BOUND(bs, 2);
                len = get_len(bs);
                CHECK_BOUND(bs, len);