* [PATCH net-2.6.24] fix network compile warnings
@ 2007-10-05 3:10 Stephen Hemminger
2007-10-06 0:14 ` [PATCH net-2.6.24] net: sparse warning fixes Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2007-10-05 3:10 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
One unused variable warning, and other is failure to check result.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c 2007-10-04 17:40:34.000000000 -0700
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c 2007-10-04 17:44:33.000000000 -0700
@@ -854,8 +854,8 @@ struct ipoib_neigh *ipoib_neigh_alloc(st
void ipoib_neigh_free(struct net_device *dev, struct ipoib_neigh *neigh)
{
- struct ipoib_dev_priv *priv = netdev_priv(dev);
struct sk_buff *skb;
+
*to_ipoib_neigh(neigh->neighbour) = NULL;
while ((skb = __skb_dequeue(&neigh->queue))) {
++dev->stats.tx_dropped;
--- a/drivers/net/cxgb3/cxgb3_main.c 2007-10-04 17:40:34.000000000 -0700
+++ b/drivers/net/cxgb3/cxgb3_main.c 2007-10-04 17:45:58.000000000 -0700
@@ -933,7 +933,8 @@ static int offload_open(struct net_devic
init_smt(adapter);
/* Never mind if the next step fails */
- sysfs_create_group(&tdev->lldev->dev.kobj, &offload_attr_group);
+ if (sysfs_create_group(&tdev->lldev->dev.kobj, &offload_attr_group))
+ dev_dbg(&tdev->lldev->dev, "sysfs offload attribute create failed\n");
/* Call back all registered clients */
cxgb3_add_clients(tdev);
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-2.6.24] net: sparse warning fixes
2007-10-05 3:10 [PATCH net-2.6.24] fix network compile warnings Stephen Hemminger
@ 2007-10-06 0:14 ` Stephen Hemminger
2007-10-08 6:59 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2007-10-06 0:14 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
Fix a bunch of sparse warnings. Mostly about 0 used as
NULL pointer, and shadowed variable declarations.
The two noteable changes are:
* hash size should have been unsigned
* cls_u32 had a case where error code wasn't been
propogated properly, so it could return 0 but still
have an error.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
include/net/inet_hashtables.h | 2 +-
include/net/sock.h | 22 +++++++++++-----------
net/appletalk/aarp.c | 2 --
net/atm/signaling.c | 2 +-
net/core/dev.c | 4 ++--
net/core/pktgen.c | 32 +++++++++++++++-----------------
net/core/scm.c | 9 ++++++---
net/ipv4/igmp.c | 5 ++---
net/ipv4/inet_lro.c | 2 +-
net/ipv4/ip_sockglue.c | 6 +++---
net/ipv4/proc.c | 2 +-
net/ipv4/route.c | 4 ++--
net/ipv4/tcp_input.c | 2 +-
net/ipv6/anycast.c | 2 +-
net/ipv6/ipv6_sockglue.c | 2 +-
net/ipv6/mcast.c | 4 ++--
net/ipv6/ndisc.c | 2 +-
net/sched/cls_u32.c | 4 ++--
net/socket.c | 2 +-
19 files changed, 54 insertions(+), 56 deletions(-)
Some of the warnings:
net/socket.c:1856:32: warning: cast adds address space to expression (<asn:1>)
net/socket.c:1932:11: warning: cast adds address space to expression (<asn:1>)
net/socket.c:2273:47: warning: incorrect type in argument 4 (different address spaces)
net/socket.c:2273:47: expected char [noderef] <asn:1>*optval
net/socket.c:2273:47: got char *optval
net/socket.c:2273:55: warning: incorrect type in argument 5 (different address spaces)
net/socket.c:2273:55: expected int [noderef] <asn:1>*optlen
net/socket.c:2273:55: got int *optlen
net/socket.c:2275:53: warning: incorrect type in argument 4 (different address spaces)
net/socket.c:2275:53: expected char [noderef] <asn:1>*optval
net/socket.c:2275:53: got char *optval
net/socket.c:2276:10: warning: incorrect type in argument 5 (different address spaces)
net/socket.c:2276:10: expected int [noderef] <asn:1>*optlen
net/socket.c:2276:10: got int *optlen
net/socket.c:2289:47: warning: incorrect type in argument 4 (different address spaces)
net/socket.c:2289:47: expected char [noderef] <asn:1>*optval
net/socket.c:2289:47: got char *optval
net/socket.c:2291:53: warning: incorrect type in argument 4 (different address spaces)
net/socket.c:2291:53: expected char [noderef] <asn:1>*optval
net/socket.c:2291:53: got char *optval
net/appletalk/aarp.c:825:23: warning: symbol 'a' shadows an earlier one
net/appletalk/aarp.c:715:20: originally declared here
include/linux/mm.h:587:9: warning: potentially expensive pointer subtraction
net/atm/signaling.c:233:19: warning: symbol 'vcc' shadows an earlier one
net/atm/signaling.c:216:39: originally declared here
net/atm/mpc.c:101:20: warning: symbol 'mpcs' was not declared. Should it be static?
net/core/sock.c:1349:7: warning: symbol 'rc' shadows an earlier one
net/core/sock.c:1344:6: originally declared here
net/core/sock.c:819:61: warning: incorrect type in argument 3 (different signedness)
net/core/sock.c:819:61: expected int *sockaddr_len
net/core/sock.c:819:61: got unsigned int *<noident>
net/core/iovec.c:45:31: warning: incorrect type in argument 1 (different address spaces)
net/core/iovec.c:45:31: expected void [noderef] <asn:1>*uaddr
net/core/iovec.c:45:31: got void *msg_name
net/core/iovec.c:56:27: warning: incorrect type in argument 2 (different address spaces)
net/core/iovec.c:56:27: expected void const [noderef] <asn:1>*from
net/core/iovec.c:56:27: got struct iovec *msg_iov
net/core/scm.c:170:31: warning: cast adds address space to expression (<asn:1>)
net/core/scm.c:193:19: warning: cast removes address space of expression
net/core/scm.c:193:19: warning: incorrect type in argument 1 (different address spaces)
net/core/scm.c:193:19: expected void [noderef] <asn:1>*to
net/core/scm.c:193:19: got void *<noident>
net/core/scm.c:205:31: warning: cast adds address space to expression (<asn:1>)
net/core/scm.c:225:33: warning: cast removes address space of expression
net/core/scm.c:225:20: warning: cast adds address space to expression (<asn:1>)
net/core/dev.c:813:7: warning: incorrect type in argument 1 (different signedness)
net/core/dev.c:813:7: expected unsigned long const *addr
net/core/dev.c:813:7: got long *[assigned] inuse
net/core/dev.c:1878:29: warning: symbol 'br_fdb_get_hook' was not declared. Should it be static?
net/core/dev.c:1880:6: warning: symbol 'br_fdb_put_hook' was not declared. Should it be static?
net/core/rtnetlink.c:1073:27: error: bad constant expression
net/core/net-sysfs.c:452:6: warning: symbol 'netdev_unregister_kobject' was not declared. Should it be static?
net/core/net-sysfs.c:461:5: warning: symbol 'netdev_register_kobject' was not declared. Should it be static?
net/core/net-sysfs.c:487:5: warning: symbol 'netdev_kobject_init' was not declared. Should it be static?
net/core/pktgen.c:1566:15: warning: symbol 'offset' shadows an earlier one
net/core/pktgen.c:908:18: originally declared here
net/core/pktgen.c:2749:9: warning: symbol 'tmp' shadows an earlier one
net/core/pktgen.c:2733:9: originally declared here
net/core/pktgen.c:2782:9: warning: symbol 'tmp' shadows an earlier one
net/core/pktgen.c:2733:9: originally declared here
net/core/pktgen.c:953:17: error: bad constant expression
net/ipv4/route.c:596:16: warning: Using plain integer as NULL pointer
net/ipv4/route.c:2980:7: warning: incorrect type in argument 6 (different signedness)
net/ipv4/route.c:2980:7: expected unsigned int *_hash_shift
net/ipv4/route.c:2980:7: got int static [toplevel] *<noident>
net/ipv4/ip_sockglue.c:662:14: warning: Using plain integer as NULL pointer
net/ipv4/ip_sockglue.c:819:14: warning: Using plain integer as NULL pointer
net/ipv4/ip_sockglue.c:839:14: warning: Using plain integer as NULL pointer
net/ipv4/ip_sockglue.c:1121:19: warning: incorrect type in assignment (different address spaces)
net/ipv4/ip_sockglue.c:1121:19: expected void *msg_control
net/ipv4/ip_sockglue.c:1121:19: got char [noderef] <asn:1>*optval
net/ipv4/tcp.c:2471:7: warning: incorrect type in argument 6 (different signedness)
net/ipv4/tcp.c:2471:7: expected unsigned int *_hash_shift
net/ipv4/tcp.c:2471:7: got int extern [toplevel] *<noident>
net/ipv4/tcp_input.c:2703:37: warning: symbol 'icsk' shadows an earlier one
net/ipv4/tcp_input.c:2578:36: originally declared here
net/ipv4/igmp.c:1698:20: warning: symbol 'in_dev' shadows an earlier one
net/ipv4/igmp.c:1656:43: originally declared here
net/ipv4/igmp.c:2170:22: warning: symbol 'psin' shadows an earlier one
net/ipv4/igmp.c:2135:21: originally declared here
net/ipv4/igmp.c:1802:21: warning: Using plain integer as NULL pointer
net/ipv4/fib_semantics.c:1071:4: warning: symbol 'nh' shadows an earlier one
net/ipv4/fib_semantics.c:1060:17: originally declared here
net/ipv4/fib_semantics.c:1136:3: warning: symbol 'nh' shadows an earlier one
net/ipv4/fib_semantics.c:1115:16: originally declared here
net/ipv4/proc.c:147:4: warning: Using plain integer as NULL pointer
net/ipv4/ipmr.c:957:10: warning: symbol 'ret' shadows an earlier one
net/ipv4/ipmr.c:872:6: originally declared here
net/ipv4/ipmr.c:144:26: warning: incorrect type in assignment (different address spaces)
net/ipv4/ipmr.c:144:26: expected void [noderef] <asn:1>*ifru_data
net/ipv4/ipmr.c:144:26: got void *<noident>
net/ipv4/tcp_htcp.c:185:11: warning: symbol '_x' shadows an earlier one
net/ipv4/tcp_htcp.c:185:11: originally declared here
net/ipv4/esp4.c:174:10: error: bad constant expression
net/ipv4/ipcomp.c:53:63: warning: incorrect type in argument 5 (different signedness)
net/ipv4/ipcomp.c:53:63: expected unsigned int *dlen
net/ipv4/ipcomp.c:53:63: got int *<noident>
net/ipv4/ipcomp.c:108:61: warning: incorrect type in argument 5 (different signedness)
net/ipv4/ipcomp.c:108:61: expected unsigned int *dlen
net/ipv4/ipcomp.c:108:61: got int *<noident>
net/ipv4/inet_lro.c:485:10: warning: Using plain integer as NULL pointer
net/ipv4/tcp_yeah.c:224:15: warning: symbol '_x' shadows an earlier one
net/ipv4/tcp_yeah.c:224:15: originally declared here
net/ipv4/tcp_yeah.c:224:15: warning: symbol '_x' shadows an earlier one
net/ipv4/tcp_yeah.c:224:15: originally declared here
net/ipv4/tcp_yeah.c:224:15: warning: symbol '_y' shadows an earlier one
net/ipv4/tcp_yeah.c:224:15: originally declared here
net/ipv6/anycast.c:417:17: warning: Using plain integer as NULL pointer
net/ipv6/addrconf.c:1891:29: warning: cast adds address space to expression (<asn:1>)
net/ipv6/ipv6_sockglue.c:666:14: warning: Using plain integer as NULL pointer
net/ipv6/ipv6_sockglue.c:875:19: warning: incorrect type in assignment (different address spaces)
net/ipv6/ipv6_sockglue.c:875:19: expected void *msg_control
net/ipv6/ipv6_sockglue.c:875:19: got char [noderef] <asn:1>*optval
net/ipv6/ndisc.c:259:53: warning: Using plain integer as NULL pointer
net/ipv6/udplite.c:43:14: warning: symbol 'udplitev6_prot' was not declared. Should it be static?
net/ipv6/udplite.c:77:13: warning: symbol 'udplitev6_init' was not declared. Should it be static?
net/ipv6/mcast.c:2074:20: warning: symbol 'idev' shadows an earlier one
net/ipv6/mcast.c:2034:44: originally declared here
net/ipv6/mcast.c:1410:13: warning: Using plain integer as NULL pointer
net/ipv6/mcast.c:2147:21: warning: Using plain integer as NULL pointer
net/ipv6/esp6.c:168:10: error: bad constant expression
net/ipv6/ipcomp6.c:94:59: warning: incorrect type in argument 5 (different signedness)
net/ipv6/ipcomp6.c:94:59: expected unsigned int *dlen
net/ipv6/ipcomp6.c:94:59: got int *<noident>
net/ipv6/ipcomp6.c:150:57: warning: incorrect type in argument 5 (different signedness)
net/ipv6/ipcomp6.c:150:57: expected unsigned int *dlen
net/ipv6/ipcomp6.c:150:57: got int *<noident>
net/ipx/af_ipx.c:1553:23: warning: symbol 'uaddr' shadows an earlier one
net/ipx/af_ipx.c:1535:61: originally declared here
net/ipx/af_ipx.c:70:5: warning: symbol 'sysctl_ipx_pprop_broadcasting' was not declared. Should it be static?
net/netlabel/netlabel_cipso_v4.c:668:21: warning: incorrect type in argument 1 (different signedness)
net/netlabel/netlabel_cipso_v4.c:668:21: expected unsigned int [usertype] *skip_cnt
net/netlabel/netlabel_cipso_v4.c:668:21: got int *<noident>
net/sched/cls_u32.c:505:7: warning: symbol 'err' shadows an earlier one
net/sched/cls_u32.c:468:6: originally declared here
net/sched/cls_u32.c:595:27: warning: Using plain integer as NULL pointer
--- a/include/net/inet_hashtables.h 2007-10-05 17:01:25.000000000 -0700
+++ b/include/net/inet_hashtables.h 2007-10-05 17:05:20.000000000 -0700
@@ -107,7 +107,7 @@ struct inet_hashinfo {
*/
struct inet_bind_hashbucket *bhash;
- int bhash_size;
+ unsigned int bhash_size;
unsigned int ehash_size;
/* All sockets in TCP_LISTEN state will be in here. This is the only
--- a/include/net/sock.h 2007-10-05 17:01:25.000000000 -0700
+++ b/include/net/sock.h 2007-10-05 17:05:20.000000000 -0700
@@ -485,17 +485,17 @@ static inline void sk_add_backlog(struct
skb->next = NULL;
}
-#define sk_wait_event(__sk, __timeo, __condition) \
-({ int rc; \
- release_sock(__sk); \
- rc = __condition; \
- if (!rc) { \
- *(__timeo) = schedule_timeout(*(__timeo)); \
- } \
- lock_sock(__sk); \
- rc = __condition; \
- rc; \
-})
+#define sk_wait_event(__sk, __timeo, __condition) \
+ ({ int __rc; \
+ release_sock(__sk); \
+ __rc = __condition; \
+ if (!__rc) { \
+ *(__timeo) = schedule_timeout(*(__timeo)); \
+ } \
+ lock_sock(__sk); \
+ __rc = __condition; \
+ __rc; \
+ })
extern int sk_stream_wait_connect(struct sock *sk, long *timeo_p);
extern int sk_stream_wait_memory(struct sock *sk, long *timeo_p);
--- a/net/appletalk/aarp.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/appletalk/aarp.c 2007-10-05 17:05:20.000000000 -0700
@@ -822,8 +822,6 @@ static int aarp_rcv(struct sk_buff *skb,
* address. So as a precaution flush any
* entries we have for this address.
*/
- struct aarp_entry *a;
-
a = __aarp_find_entry(resolved[sa.s_node %
(AARP_HASH_SIZE - 1)],
skb->dev, &sa);
--- a/net/atm/signaling.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/atm/signaling.c 2007-10-05 17:05:20.000000000 -0700
@@ -230,7 +230,7 @@ static void sigd_close(struct atm_vcc *v
struct hlist_head *head = &vcc_hash[i];
sk_for_each(s, node, head) {
- struct atm_vcc *vcc = atm_sk(s);
+ vcc = atm_sk(s);
purge_vcc(vcc);
}
--- a/net/core/dev.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/core/dev.c 2007-10-05 17:05:20.000000000 -0700
@@ -780,7 +780,7 @@ static int __dev_alloc_name(struct net *
int i = 0;
const char *p;
const int max_netdevices = 8*PAGE_SIZE;
- long *inuse;
+ unsigned long *inuse;
struct net_device *d;
p = strnchr(name, IFNAMSIZ-1, '%');
@@ -794,7 +794,7 @@ static int __dev_alloc_name(struct net *
return -EINVAL;
/* Use one page as a bit array of possible slots */
- inuse = (long *) get_zeroed_page(GFP_ATOMIC);
+ inuse = (unsigned long *) get_zeroed_page(GFP_ATOMIC);
if (!inuse)
return -ENOMEM;
--- a/net/core/pktgen.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/core/pktgen.c 2007-10-05 17:05:20.000000000 -0700
@@ -6,7 +6,7 @@
*
* Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
* Ben Greear <greearb@candelatech.com>
- * Jens Låås <jens.laas@data.slu.se>
+ * Jens Låås <jens.laas@data.slu.se>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -1563,15 +1563,17 @@ static ssize_t pktgen_if_write(struct fi
}
if (!strcmp(name, "mpls")) {
- unsigned n, offset;
+ unsigned n, cnt;
+
len = get_labels(&user_buffer[i], pkt_dev);
- if (len < 0) { return len; }
+ if (len < 0)
+ return len;
i += len;
- offset = sprintf(pg_result, "OK: mpls=");
+ cnt = sprintf(pg_result, "OK: mpls=");
for (n = 0; n < pkt_dev->nr_labels; n++)
- offset += sprintf(pg_result + offset,
- "%08x%s", ntohl(pkt_dev->labels[n]),
- n == pkt_dev->nr_labels-1 ? "" : ",");
+ cnt += sprintf(pg_result + cnt,
+ "%08x%s", ntohl(pkt_dev->labels[n]),
+ n == pkt_dev->nr_labels-1 ? "" : ",");
if (pkt_dev->nr_labels && pkt_dev->vlan_id != 0xffff) {
pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */
@@ -2731,6 +2733,7 @@ static unsigned int scan_ip6(const char
unsigned int prefixlen = 0;
unsigned int suffixlen = 0;
__be32 tmp;
+ char *pos;
for (i = 0; i < 16; i++)
ip[i] = 0;
@@ -2745,12 +2748,9 @@ static unsigned int scan_ip6(const char
}
s++;
}
- {
- char *tmp;
- u = simple_strtoul(s, &tmp, 16);
- i = tmp - s;
- }
+ u = simple_strtoul(s, &pos, 16);
+ i = pos - s;
if (!i)
return 0;
if (prefixlen == 12 && s[i] == '.') {
@@ -2778,11 +2778,9 @@ static unsigned int scan_ip6(const char
len++;
} else if (suffixlen != 0)
break;
- {
- char *tmp;
- u = simple_strtol(s, &tmp, 16);
- i = tmp - s;
- }
+
+ u = simple_strtol(s, &pos, 16);
+ i = pos - s;
if (!i) {
if (*s)
len--;
--- a/net/core/scm.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/core/scm.c 2007-10-05 17:05:20.000000000 -0700
@@ -167,7 +167,8 @@ error:
int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
{
- struct cmsghdr __user *cm = (struct cmsghdr __user *)msg->msg_control;
+ struct cmsghdr __user *cm
+ = (__force struct cmsghdr __user *)msg->msg_control;
struct cmsghdr cmhdr;
int cmlen = CMSG_LEN(len);
int err;
@@ -202,7 +203,8 @@ out:
void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
{
- struct cmsghdr __user *cm = (struct cmsghdr __user*)msg->msg_control;
+ struct cmsghdr __user *cm
+ = (__force struct cmsghdr __user*)msg->msg_control;
int fdmax = 0;
int fdnum = scm->fp->count;
@@ -222,7 +224,8 @@ void scm_detach_fds(struct msghdr *msg,
if (fdnum < fdmax)
fdmax = fdnum;
- for (i=0, cmfptr=(int __user *)CMSG_DATA(cm); i<fdmax; i++, cmfptr++)
+ for (i=0, cmfptr=(__force int __user *)CMSG_DATA(cm); i<fdmax;
+ i++, cmfptr++)
{
int new_fd;
err = security_file_receive(fp[i]);
--- a/net/ipv4/igmp.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv4/igmp.c 2007-10-05 17:05:20.000000000 -0700
@@ -1695,8 +1695,8 @@ static int ip_mc_add_src(struct in_devic
(void) ip_mc_del1_src(pmc, sfmode, &psfsrc[i]);
} else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) {
#ifdef CONFIG_IP_MULTICAST
- struct in_device *in_dev = pmc->interface;
struct ip_sf_list *psf;
+ in_dev = pmc->interface;
#endif
/* filter mode change */
@@ -1799,7 +1799,7 @@ static int ip_mc_leave_src(struct sock *
{
int err;
- if (iml->sflist == 0) {
+ if (iml->sflist == NULL) {
/* any-source empty exclude case */
return ip_mc_del_src(in_dev, &iml->multi.imr_multiaddr.s_addr,
iml->sfmode, 0, NULL, 0);
@@ -2167,7 +2167,6 @@ int ip_mc_gsfget(struct sock *sk, struct
return -EFAULT;
}
for (i=0; i<copycount; i++) {
- struct sockaddr_in *psin;
struct sockaddr_storage ss;
psin = (struct sockaddr_in *)&ss;
--- a/net/ipv4/inet_lro.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv4/inet_lro.c 2007-10-05 17:05:20.000000000 -0700
@@ -482,7 +482,7 @@ static struct sk_buff *__lro_proc_segmen
lro_init_desc(lro_desc, skb, iph, tcph, 0, NULL);
LRO_INC_STATS(lro_mgr, aggregated);
- return 0;
+ return NULL;
}
if (lro_desc->tcp_next_seq != ntohl(tcph->seq))
--- a/net/ipv4/ip_sockglue.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv4/ip_sockglue.c 2007-10-05 17:05:20.000000000 -0700
@@ -659,7 +659,7 @@ static int do_ip_setsockopt(struct sock
break;
}
msf = kmalloc(optlen, GFP_KERNEL);
- if (msf == 0) {
+ if (!msf) {
err = -ENOBUFS;
break;
}
@@ -816,7 +816,7 @@ static int do_ip_setsockopt(struct sock
break;
}
gsf = kmalloc(optlen,GFP_KERNEL);
- if (gsf == 0) {
+ if (!gsf) {
err = -ENOBUFS;
break;
}
@@ -836,7 +836,7 @@ static int do_ip_setsockopt(struct sock
}
msize = IP_MSFILTER_SIZE(gsf->gf_numsrc);
msf = kmalloc(msize,GFP_KERNEL);
- if (msf == 0) {
+ if (!msf) {
err = -ENOBUFS;
goto mc_msf_out;
}
--- a/net/ipv4/proc.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv4/proc.c 2007-10-05 17:05:20.000000000 -0700
@@ -144,7 +144,7 @@ static struct {
{ "TimestampReps", ICMP_TIMESTAMPREPLY },
{ "AddrMasks", ICMP_ADDRESS },
{ "AddrMaskReps", ICMP_ADDRESSREPLY },
- { 0, 0 }
+ { NULL, 0 }
};
--- a/net/ipv4/route.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv4/route.c 2007-10-05 17:05:20.000000000 -0700
@@ -246,7 +246,7 @@ static spinlock_t *rt_hash_locks;
static struct rt_hash_bucket *rt_hash_table;
static unsigned rt_hash_mask;
-static int rt_hash_log;
+static unsigned int rt_hash_log;
static unsigned int rt_hash_rnd;
static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
@@ -593,7 +593,7 @@ static void rt_check_expire(struct work_
i = (i + 1) & rt_hash_mask;
rthp = &rt_hash_table[i].chain;
- if (*rthp == 0)
+ if (*rthp == NULL)
continue;
spin_lock_bh(rt_hash_lock_addr(i));
while ((rth = *rthp) != NULL) {
--- a/net/ipv4/tcp_input.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv4/tcp_input.c 2007-10-05 17:05:20.000000000 -0700
@@ -2700,7 +2700,7 @@ static int tcp_clean_rtx_queue(struct so
BUG_TRAP((int)tp->lost_out >= 0);
BUG_TRAP((int)tp->retrans_out >= 0);
if (!tp->packets_out && tcp_is_sack(tp)) {
- const struct inet_connection_sock *icsk = inet_csk(sk);
+ icsk = inet_csk(sk);
if (tp->lost_out) {
printk(KERN_DEBUG "Leak l=%u %d\n",
tp->lost_out, icsk->icsk_ca_state);
--- a/net/ipv6/anycast.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv6/anycast.c 2007-10-05 17:05:20.000000000 -0700
@@ -414,7 +414,7 @@ static int ipv6_chk_acast_dev(struct net
break;
read_unlock_bh(&idev->lock);
in6_dev_put(idev);
- return aca != 0;
+ return aca != NULL;
}
return 0;
}
--- a/net/ipv6/ipv6_sockglue.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv6/ipv6_sockglue.c 2007-10-05 17:05:20.000000000 -0700
@@ -663,7 +663,7 @@ done:
break;
}
gsf = kmalloc(optlen,GFP_KERNEL);
- if (gsf == 0) {
+ if (!gsf) {
retv = -ENOBUFS;
break;
}
--- a/net/ipv6/mcast.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv6/mcast.c 2007-10-05 17:05:20.000000000 -0700
@@ -1407,7 +1407,7 @@ static struct sk_buff *mld_newpack(struc
/* we assume size > sizeof(ra) here */
skb = sock_alloc_send_skb(sk, size + LL_RESERVED_SPACE(dev), 1, &err);
- if (skb == 0)
+ if (!skb)
return NULL;
skb_reserve(skb, LL_RESERVED_SPACE(dev));
@@ -2144,7 +2144,7 @@ static int ip6_mc_leave_src(struct sock
/* callers have the socket lock and a write lock on ipv6_sk_mc_lock,
* so no other readers or writers of iml or its sflist
*/
- if (iml->sflist == 0) {
+ if (!iml->sflist) {
/* any-source empty exclude case */
return ip6_mc_del_src(idev, &iml->addr, iml->sfmode, 0, NULL, 0);
}
--- a/net/ipv6/ndisc.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/ipv6/ndisc.c 2007-10-05 17:05:20.000000000 -0700
@@ -256,7 +256,7 @@ static struct ndisc_options *ndisc_parse
break;
case ND_OPT_PREFIX_INFO:
ndopts->nd_opts_pi_end = nd_opt;
- if (ndopts->nd_opt_array[nd_opt->nd_opt_type] == 0)
+ if (!ndopts->nd_opt_array[nd_opt->nd_opt_type])
ndopts->nd_opt_array[nd_opt->nd_opt_type] = nd_opt;
break;
#ifdef CONFIG_IPV6_ROUTE_INFO
--- a/net/sched/cls_u32.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/sched/cls_u32.c 2007-10-05 17:05:20.000000000 -0700
@@ -502,7 +502,7 @@ static int u32_set_parms(struct tcf_prot
#ifdef CONFIG_NET_CLS_IND
if (tb[TCA_U32_INDEV-1]) {
- int err = tcf_change_indev(tp, n->indev, tb[TCA_U32_INDEV-1]);
+ err = tcf_change_indev(tp, n->indev, tb[TCA_U32_INDEV-1]);
if (err < 0)
goto errout;
}
@@ -592,7 +592,7 @@ static int u32_change(struct tcf_proto *
} else
handle = gen_new_kid(ht, htid);
- if (tb[TCA_U32_SEL-1] == 0 ||
+ if (tb[TCA_U32_SEL-1] == NULL ||
RTA_PAYLOAD(tb[TCA_U32_SEL-1]) < sizeof(struct tc_u32_sel))
return -EINVAL;
--- a/net/socket.c 2007-10-05 17:01:25.000000000 -0700
+++ b/net/socket.c 2007-10-05 17:05:20.000000000 -0700
@@ -1929,7 +1929,7 @@ asmlinkage long sys_recvmsg(int fd, stru
* kernel msghdr to use the kernel address space)
*/
- uaddr = (void __user *)msg_sys.msg_name;
+ uaddr = (__force void __user *)msg_sys.msg_name;
uaddr_len = COMPAT_NAMELEN(msg);
if (MSG_CMSG_COMPAT & flags) {
err = verify_compat_iovec(&msg_sys, iov, addr, VERIFY_WRITE);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-2.6.24] net: sparse warning fixes
2007-10-06 0:14 ` [PATCH net-2.6.24] net: sparse warning fixes Stephen Hemminger
@ 2007-10-08 6:59 ` David Miller
2007-10-08 15:30 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2007-10-08 6:59 UTC (permalink / raw)
To: shemminger; +Cc: netdev
From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Fri, 5 Oct 2007 17:14:07 -0700
> Fix a bunch of sparse warnings. Mostly about 0 used as
> NULL pointer, and shadowed variable declarations.
>
> The two noteable changes are:
> * hash size should have been unsigned
> * cls_u32 had a case where error code wasn't been
> propogated properly, so it could return 0 but still
> have an error.
>
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Applied, and I stuffed the cls_u32 fix into net-2.6 as well.
But please fix the following, this is the second time I've
had to remove this bit from one of your patches.
> @@ -6,7 +6,7 @@
> *
> * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> * Ben Greear <greearb@candelatech.com>
> - * Jens Låås <jens.laas@data.slu.se>
> + * Jens Låås <jens.laas@data.slu.se>
> *
> * This program is free software; you can redistribute it and/or
> * modify it under the terms of the GNU General Public License
Please please please please, for the second time, fix the encoding
your editor uses when you save copies of this source file, this hunk
of your patches never applies cleanly.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-2.6.24] net: sparse warning fixes
2007-10-08 6:59 ` David Miller
@ 2007-10-08 15:30 ` Stephen Hemminger
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2007-10-08 15:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On Sun, 07 Oct 2007 23:59:56 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Fri, 5 Oct 2007 17:14:07 -0700
>
> > Fix a bunch of sparse warnings. Mostly about 0 used as
> > NULL pointer, and shadowed variable declarations.
> >
> > The two noteable changes are:
> > * hash size should have been unsigned
> > * cls_u32 had a case where error code wasn't been
> > propogated properly, so it could return 0 but still
> > have an error.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
>
> Applied, and I stuffed the cls_u32 fix into net-2.6 as well.
>
> But please fix the following, this is the second time I've
> had to remove this bit from one of your patches.
>
> > @@ -6,7 +6,7 @@
> > *
> > * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> > * Ben Greear <greearb@candelatech.com>
> > - * Jens Låås <jens.laas@data.slu.se>
> > + * Jens Låås <jens.laas@data.slu.se>
> > *
> > * This program is free software; you can redistribute it and/or
> > * modify it under the terms of the GNU General Public License
>
> Please please please please, for the second time, fix the encoding
> your editor uses when you save copies of this source file, this hunk
> of your patches never applies cleanly.
>
It's either an Emacs or quilt problem. Probably emacs.
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-08 15:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-05 3:10 [PATCH net-2.6.24] fix network compile warnings Stephen Hemminger
2007-10-06 0:14 ` [PATCH net-2.6.24] net: sparse warning fixes Stephen Hemminger
2007-10-08 6:59 ` David Miller
2007-10-08 15:30 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).