* question about RT_TABLE_MAX
@ 2012-11-12 14:51 Dan Carpenter
2012-11-15 1:28 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-11-12 14:51 UTC (permalink / raw)
To: netdev
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: question about RT_TABLE_MAX
2012-11-12 14:51 question about RT_TABLE_MAX Dan Carpenter
@ 2012-11-15 1:28 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-11-15 1:28 UTC (permalink / raw)
To: dan.carpenter; +Cc: netdev
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 12 Nov 2012 17:51:35 +0300
> RT_TABLE_MAX is 0xFFFFFFFF. 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 <kaber@trash.net>
Date: Thu Aug 10 23:12:34 2006 -0700
[NET]: Increate RT_TABLE_MAX to 2^32
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-15 1:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-12 14:51 question about RT_TABLE_MAX Dan Carpenter
2012-11-15 1:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).