[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121112145135.GA32199@elgon.mountain>
Date: Mon, 12 Nov 2012 17:51:35 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: netdev@...r.kernel.org
Subject: question about RT_TABLE_MAX
RT_TABLE_MAX is 0xFFFFFFFF. It's always compared against an unsigned
int so the checks against it don't test anything.
net/decnet/dn_table.c
828 struct dn_fib_table *dn_fib_get_table(u32 n, int create)
829 {
830 struct dn_fib_table *t;
831 struct hlist_node *node;
832 unsigned int h;
833
834 if (n < RT_TABLE_MIN)
835 return NULL;
836
837 if (n > RT_TABLE_MAX)
^^^^^^^^^^^^^^^^
Never true.
838 return NULL;
net/decnet/dn_table.c
874 struct dn_fib_table *dn_fib_empty_table(void)
875 {
876 u32 id;
877
878 for(id = RT_TABLE_MIN; id <= RT_TABLE_MAX; id++)
^^^^^^^^^^^^^^^^^^
Always true.
879 if (dn_fib_get_table(id, 0) == NULL)
880 return dn_fib_get_table(id, 1);
881 return NULL;
882 }
net/ipv4/fib_rules.c
122 static struct fib_table *fib_empty_table(struct net *net)
123 {
124 u32 id;
125
126 for (id = 1; id <= RT_TABLE_MAX; id++)
^^^^^^^^^^^^^^^^^^
Always true.
127 if (fib_get_table(net, id) == NULL)
128 return fib_new_table(net, id);
129 return NULL;
130 }
Maybe it should be id < RT_TABLE_MAX?
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists