public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* 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

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