question about RT_TABLE_MAX
Subsystems (2)
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
David Miller
maintainerFrom: Dan Carpenter <[email protected]>
Date: Mon, 12 Nov 2012 17:51:35 +0300
Quoted 2 lines
RT_TABLE_MAXis0xFFFFFFFF. It's always compared against an unsigned int so the checks against it don't test anything.
It used to be 256, that's why the spurious tests are there, they just need to be cleaned up.
This change happened in commit:
commit b801f54917b7c6e8540f877ee562cd0725e62ebd
Author: Patrick McHardy <[email protected]> Date: Thu Aug 10 23:12:34 2006 -0700
[NET]: Increate RT_TABLE_MAX to 2^32