diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-10-12 00:49:15 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-10-12 00:49:15 -0700 |
commit | 8238b218ec883adb44d710960a031c76105274cd (patch) | |
tree | 09880b229d0090298f30bf0168a4702bbc0e918a /net/decnet | |
parent | 42b6785eeb40fe3e9dab9981b6e3231a77c7c2f6 (diff) | |
download | kernel_samsung_tuna-8238b218ec883adb44d710960a031c76105274cd.zip kernel_samsung_tuna-8238b218ec883adb44d710960a031c76105274cd.tar.gz kernel_samsung_tuna-8238b218ec883adb44d710960a031c76105274cd.tar.bz2 |
[NET]: Do not memcmp() over pad bytes of struct flowi.
They are not necessarily initialized to zero by the compiler,
for example when using run-time initializers of automatic
on-stack variables.
Noticed by Eric Dumazet and Patrick McHardy.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet')
-rw-r--r-- | net/decnet/dn_route.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index dd0761e..a2a43d8 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -267,9 +267,14 @@ static void dn_dst_link_failure(struct sk_buff *skb) static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) { - return memcmp(&fl1->nl_u.dn_u, &fl2->nl_u.dn_u, sizeof(fl1->nl_u.dn_u)) == 0 && - fl1->oif == fl2->oif && - fl1->iif == fl2->iif; + return ((fl1->nl_u.dn_u.daddr ^ fl2->nl_u.dn_u.daddr) | + (fl1->nl_u.dn_u.saddr ^ fl2->nl_u.dn_u.saddr) | +#ifdef CONFIG_IP_ROUTE_FWMARK + (fl1->nl_u.dn_u.fwmark ^ fl2->nl_u.dn_u.fwmark) | +#endif + (fl1->nl_u.dn_u.scope ^ fl2->nl_u.dn_u.scope) | + (fl1->oif ^ fl2->oif) | + (fl1->iif ^ fl2->iif)) == 0; } static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route **rp) |