From: Dan Carpenter <dan.carpenter@oracle.com>
To: netdev@vger.kernel.org
Subject: question about RT_TABLE_MAX
Date: Mon, 12 Nov 2012 17:51:35 +0300 [thread overview]
Message-ID: <20121112145135.GA32199@elgon.mountain> (raw)
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
next reply other threads:[~2012-11-12 14:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 14:51 Dan Carpenter [this message]
2012-11-15 1:28 ` question about RT_TABLE_MAX David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121112145135.GA32199@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.