All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ipmr: fix sparse warning when testing origin or group
       [not found] <50fe2be1.tv57lZmJcPMuyVta%fengguang.wu@intel.com>
@ 2013-01-22 10:18 ` Nicolas Dichtel
  2013-01-22 19:24   ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Dichtel @ 2013-01-22 10:18 UTC (permalink / raw)
  To: fengguang.wu; +Cc: netdev, davem, Nicolas Dichtel

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>
---
 net/ipv4/ipmr.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 4b5e226..7085b9b 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,
 static struct mfc_cache *ipmr_cache_find_any_parent(struct mr_table *mrt,
 						    int vifi)
 {
-	int line = MFC_HASH(INADDR_ANY, INADDR_ANY);
+	int line = MFC_HASH(htonl(INADDR_ANY), htonl(INADDR_ANY));
 	struct mfc_cache *c;
 
 	list_for_each_entry_rcu(c, &mrt->mfc_cache_array[line], list)
-		if (c->mfc_origin == INADDR_ANY &&
-		    c->mfc_mcastgrp == INADDR_ANY &&
+		if (c->mfc_origin == htonl(INADDR_ANY) &&
+		    c->mfc_mcastgrp == htonl(INADDR_ANY) &&
 		    c->mfc_un.res.ttls[vifi] < 255)
 			return c;
 
@@ -848,14 +848,14 @@ static struct mfc_cache *ipmr_cache_find_any_parent(struct mr_table *mrt,
 static struct mfc_cache *ipmr_cache_find_any(struct mr_table *mrt,
 					     __be32 mcastgrp, int vifi)
 {
-	int line = MFC_HASH(mcastgrp, INADDR_ANY);
+	int line = MFC_HASH(mcastgrp, htonl(INADDR_ANY));
 	struct mfc_cache *c, *proxy;
 
-	if (mcastgrp == INADDR_ANY)
+	if (mcastgrp == htonl(INADDR_ANY))
 		goto skip;
 
 	list_for_each_entry_rcu(c, &mrt->mfc_cache_array[line], list)
-		if (c->mfc_origin == INADDR_ANY &&
+		if (c->mfc_origin == htonl(INADDR_ANY) &&
 		    c->mfc_mcastgrp == mcastgrp) {
 			if (c->mfc_un.res.ttls[vifi] < 255)
 				return c;
@@ -1148,7 +1148,7 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt,
 		return 0;
 	}
 
-	if (mfc->mfcc_mcastgrp.s_addr != INADDR_ANY &&
+	if (mfc->mfcc_mcastgrp.s_addr != htonl(INADDR_ANY) &&
 	    !ipv4_is_multicast(mfc->mfcc_mcastgrp.s_addr))
 		return -EINVAL;
 
@@ -1807,7 +1807,7 @@ static int ip_mr_forward(struct net *net, struct mr_table *mrt,
 	cache->mfc_un.res.pkt++;
 	cache->mfc_un.res.bytes += skb->len;
 
-	if (cache->mfc_origin == INADDR_ANY && true_vifi >= 0) {
+	if (cache->mfc_origin == htonl(INADDR_ANY) && true_vifi >= 0) {
 		struct mfc_cache *cache_proxy;
 
 		/* For an (*,G) entry, we only check that the incomming
@@ -1863,8 +1863,8 @@ forward:
 	/*
 	 *	Forward the frame
 	 */
-	if (cache->mfc_origin == INADDR_ANY &&
-	    cache->mfc_mcastgrp == INADDR_ANY) {
+	if (cache->mfc_origin == htonl(INADDR_ANY) &&
+	    cache->mfc_mcastgrp == htonl(INADDR_ANY)) {
 		if (true_vifi >= 0 &&
 		    true_vifi != cache->mfc_parent &&
 		    ip_hdr(skb)->ttl >
@@ -1881,7 +1881,8 @@ forward:
 	for (ct = cache->mfc_un.res.maxvif - 1;
 	     ct >= cache->mfc_un.res.minvif; ct--) {
 		/* For (*,G) entry, don't forward to the incoming interface */
-		if ((cache->mfc_origin != INADDR_ANY || ct != true_vifi) &&
+		if ((cache->mfc_origin != htonl(INADDR_ANY) ||
+		     ct != true_vifi) &&
 		    ip_hdr(skb)->ttl > cache->mfc_un.res.ttls[ct]) {
 			if (psend != -1) {
 				struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
-- 
1.8.0.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] ipmr: fix sparse warning when testing origin or group
  2013-01-22 10:18 ` [PATCH net-next] ipmr: fix sparse warning when testing origin or group Nicolas Dichtel
@ 2013-01-22 19:24   ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-01-22 19:24 UTC (permalink / raw)
  To: nicolas.dichtel; +Cc: fengguang.wu, netdev

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue, 22 Jan 2013 11:18:03 +0100

> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-22 19:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <50fe2be1.tv57lZmJcPMuyVta%fengguang.wu@intel.com>
2013-01-22 10:18 ` [PATCH net-next] ipmr: fix sparse warning when testing origin or group Nicolas Dichtel
2013-01-22 19:24   ` David Miller

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.