Commit f286dd8e authored by Rahul Lakkireddy's avatar Rahul Lakkireddy Committed by David S. Miller

cxgb4: use correct type for all-mask IP address comparison

Use correct type to check for all-mask exact match IP addresses.

Fixes following sparse warnings due to big endian value checks
against 0xffffffff in is_addr_all_mask():
cxgb4_filter.c:977:25: warning: restricted __be32 degrades to integer
cxgb4_filter.c:983:37: warning: restricted __be32 degrades to integer
cxgb4_filter.c:984:37: warning: restricted __be32 degrades to integer
cxgb4_filter.c:985:37: warning: restricted __be32 degrades to integer
cxgb4_filter.c:986:37: warning: restricted __be32 degrades to integer

Fixes: 3eb8b62d ("cxgb4: add support to create hash-filters via tc-flower offload")
Signed-off-by: default avatarRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 63b53b0b
...@@ -1112,16 +1112,16 @@ static bool is_addr_all_mask(u8 *ipmask, int family) ...@@ -1112,16 +1112,16 @@ static bool is_addr_all_mask(u8 *ipmask, int family)
struct in_addr *addr; struct in_addr *addr;
addr = (struct in_addr *)ipmask; addr = (struct in_addr *)ipmask;
if (addr->s_addr == 0xffffffff) if (ntohl(addr->s_addr) == 0xffffffff)
return true; return true;
} else if (family == AF_INET6) { } else if (family == AF_INET6) {
struct in6_addr *addr6; struct in6_addr *addr6;
addr6 = (struct in6_addr *)ipmask; addr6 = (struct in6_addr *)ipmask;
if (addr6->s6_addr32[0] == 0xffffffff && if (ntohl(addr6->s6_addr32[0]) == 0xffffffff &&
addr6->s6_addr32[1] == 0xffffffff && ntohl(addr6->s6_addr32[1]) == 0xffffffff &&
addr6->s6_addr32[2] == 0xffffffff && ntohl(addr6->s6_addr32[2]) == 0xffffffff &&
addr6->s6_addr32[3] == 0xffffffff) ntohl(addr6->s6_addr32[3]) == 0xffffffff)
return true; return true;
} }
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment