aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2013-01-22 05:18:03 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-22 14:24:29 -0500
commit360eb5da665566a110993c58ed2a63e98f6720bf (patch)
treef1f55ebd16d69cc804016121e797443e869d8ff7 /net
parent63b203b43baeb1ba5fab0b7f3611e0f0a2a4a7ab (diff)
ipmr: fix sparse warning when testing origin or group
mfc_mcastgrp and mfc_origin are __be32, thus we need to convert INADDR_ANY. Because INADDR_ANY is 0, this patch just fix sparse warnings. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ipmr.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 4b5e22670d44..7085b9b51e7f 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -832,12 +832,12 @@ static struct mfc_cache *ipmr_cache_find(struct mr_table *mrt,
832static struct mfc_cache *ipmr_cache_find_any_parent(struct mr_table *mrt, 832static struct mfc_cache *ipmr_cache_find_any_parent(struct mr_table *mrt,
833 int vifi) 833 int vifi)
834{ 834{
835 int line = MFC_HASH(INADDR_ANY, INADDR_ANY); 835 int line = MFC_HASH(htonl(INADDR_ANY), htonl(INADDR_ANY));
836 struct mfc_cache *c; 836 struct mfc_cache *c;
837 837
838 list_for_each_entry_rcu(c, &mrt->mfc_cache_array[line], list) 838 list_for_each_entry_rcu(c, &mrt->mfc_cache_array[line], list)
839 if (c->mfc_origin == INADDR_ANY && 839 if (c->mfc_origin == htonl(INADDR_ANY) &&
840 c->mfc_mcastgrp == INADDR_ANY && 840 c->mfc_mcastgrp == htonl(INADDR_ANY) &&
841 c->mfc_un.res.ttls[vifi] < 255) 841 c->mfc_un.res.ttls[vifi] < 255)
842 return c; 842 return c;
843 843
@@ -848,14 +848,14 @@ static struct mfc_cache *ipmr_cache_find_any_parent(struct mr_table *mrt,
848static struct mfc_cache *ipmr_cache_find_any(struct mr_table *mrt, 848static struct mfc_cache *ipmr_cache_find_any(struct mr_table *mrt,
849 __be32 mcastgrp, int vifi) 849 __be32 mcastgrp, int vifi)
850{ 850{
851 int line = MFC_HASH(mcastgrp, INADDR_ANY); 851 int line = MFC_HASH(mcastgrp, htonl(INADDR_ANY));
852 struct mfc_cache *c, *proxy; 852 struct mfc_cache *c, *proxy;
853 853
854 if (mcastgrp == INADDR_ANY) 854 if (mcastgrp == htonl(INADDR_ANY))
855 goto skip; 855 goto skip;
856 856
857 list_for_each_entry_rcu(c, &mrt->mfc_cache_array[line], list) 857 list_for_each_entry_rcu(c, &mrt->mfc_cache_array[line], list)
858 if (c->mfc_origin == INADDR_ANY && 858 if (c->mfc_origin == htonl(INADDR_ANY) &&
859 c->mfc_mcastgrp == mcastgrp) { 859 c->mfc_mcastgrp == mcastgrp) {
860 if (c->mfc_un.res.ttls[vifi] < 255) 860 if (c->mfc_un.res.ttls[vifi] < 255)
861 return c; 861 return c;
@@ -1148,7 +1148,7 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt,
1148 return 0; 1148 return 0;
1149 } 1149 }
1150 1150
1151 if (mfc->mfcc_mcastgrp.s_addr != INADDR_ANY && 1151 if (mfc->mfcc_mcastgrp.s_addr != htonl(INADDR_ANY) &&
1152 !ipv4_is_multicast(mfc->mfcc_mcastgrp.s_addr)) 1152 !ipv4_is_multicast(mfc->mfcc_mcastgrp.s_addr))
1153 return -EINVAL; 1153 return -EINVAL;
1154 1154
@@ -1807,7 +1807,7 @@ static int ip_mr_forward(struct net *net, struct mr_table *mrt,
1807 cache->mfc_un.res.pkt++; 1807 cache->mfc_un.res.pkt++;
1808 cache->mfc_un.res.bytes += skb->len; 1808 cache->mfc_un.res.bytes += skb->len;
1809 1809
1810 if (cache->mfc_origin == INADDR_ANY && true_vifi >= 0) { 1810 if (cache->mfc_origin == htonl(INADDR_ANY) && true_vifi >= 0) {
1811 struct mfc_cache *cache_proxy; 1811 struct mfc_cache *cache_proxy;
1812 1812
1813 /* For an (*,G) entry, we only check that the incomming 1813 /* For an (*,G) entry, we only check that the incomming
@@ -1863,8 +1863,8 @@ forward:
1863 /* 1863 /*
1864 * Forward the frame 1864 * Forward the frame
1865 */ 1865 */
1866 if (cache->mfc_origin == INADDR_ANY && 1866 if (cache->mfc_origin == htonl(INADDR_ANY) &&
1867 cache->mfc_mcastgrp == INADDR_ANY) { 1867 cache->mfc_mcastgrp == htonl(INADDR_ANY)) {
1868 if (true_vifi >= 0 && 1868 if (true_vifi >= 0 &&
1869 true_vifi != cache->mfc_parent && 1869 true_vifi != cache->mfc_parent &&
1870 ip_hdr(skb)->ttl > 1870 ip_hdr(skb)->ttl >
@@ -1881,7 +1881,8 @@ forward:
1881 for (ct = cache->mfc_un.res.maxvif - 1; 1881 for (ct = cache->mfc_un.res.maxvif - 1;
1882 ct >= cache->mfc_un.res.minvif; ct--) { 1882 ct >= cache->mfc_un.res.minvif; ct--) {
1883 /* For (*,G) entry, don't forward to the incoming interface */ 1883 /* For (*,G) entry, don't forward to the incoming interface */
1884 if ((cache->mfc_origin != INADDR_ANY || ct != true_vifi) && 1884 if ((cache->mfc_origin != htonl(INADDR_ANY) ||
1885 ct != true_vifi) &&
1885 ip_hdr(skb)->ttl > cache->mfc_un.res.ttls[ct]) { 1886 ip_hdr(skb)->ttl > cache->mfc_un.res.ttls[ct]) {
1886 if (psend != -1) { 1887 if (psend != -1) {
1887 struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); 1888 struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);