diff options
author | Ian Morris <ipm@chirality.org.uk> | 2015-04-03 04:17:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-03 12:11:15 -0400 |
commit | 51456b2914a34d16b1255b7c55d5cbf6a681d306 (patch) | |
tree | b8f1135150269f591105f787fbf7c7d8c2307d3e /net/ipv4/route.c | |
parent | 11a9c7821c583aa22b35f37fba20539def9e8f14 (diff) |
ipv4: coding style: comparison for equality with NULL
The ipv4 code uses a mixture of coding styles. In some instances check
for NULL pointer is done as x == NULL and sometimes as !x. !x is
preferred according to checkpatch and this patch makes the code
consistent by adopting the latter form.
No changes detected by objdiff.
Signed-off-by: Ian Morris <ipm@chirality.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 652b92ebd7ba..26a1cb348b3d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1056,7 +1056,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | |||
1056 | __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); | 1056 | __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); |
1057 | 1057 | ||
1058 | rt = (struct rtable *)odst; | 1058 | rt = (struct rtable *)odst; |
1059 | if (odst->obsolete && odst->ops->check(odst, 0) == NULL) { | 1059 | if (odst->obsolete && !odst->ops->check(odst, 0)) { |
1060 | rt = ip_route_output_flow(sock_net(sk), &fl4, sk); | 1060 | rt = ip_route_output_flow(sock_net(sk), &fl4, sk); |
1061 | if (IS_ERR(rt)) | 1061 | if (IS_ERR(rt)) |
1062 | goto out; | 1062 | goto out; |
@@ -1450,7 +1450,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1450 | 1450 | ||
1451 | /* Primary sanity checks. */ | 1451 | /* Primary sanity checks. */ |
1452 | 1452 | ||
1453 | if (in_dev == NULL) | 1453 | if (!in_dev) |
1454 | return -EINVAL; | 1454 | return -EINVAL; |
1455 | 1455 | ||
1456 | if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr) || | 1456 | if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr) || |
@@ -1553,7 +1553,7 @@ static int __mkroute_input(struct sk_buff *skb, | |||
1553 | 1553 | ||
1554 | /* get a working reference to the output device */ | 1554 | /* get a working reference to the output device */ |
1555 | out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res)); | 1555 | out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res)); |
1556 | if (out_dev == NULL) { | 1556 | if (!out_dev) { |
1557 | net_crit_ratelimited("Bug in ip_route_input_slow(). Please report.\n"); | 1557 | net_crit_ratelimited("Bug in ip_route_input_slow(). Please report.\n"); |
1558 | return -EINVAL; | 1558 | return -EINVAL; |
1559 | } | 1559 | } |
@@ -2054,7 +2054,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4) | |||
2054 | ipv4_is_lbcast(fl4->daddr))) { | 2054 | ipv4_is_lbcast(fl4->daddr))) { |
2055 | /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ | 2055 | /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ |
2056 | dev_out = __ip_dev_find(net, fl4->saddr, false); | 2056 | dev_out = __ip_dev_find(net, fl4->saddr, false); |
2057 | if (dev_out == NULL) | 2057 | if (!dev_out) |
2058 | goto out; | 2058 | goto out; |
2059 | 2059 | ||
2060 | /* Special hack: user can direct multicasts | 2060 | /* Special hack: user can direct multicasts |
@@ -2087,7 +2087,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4) | |||
2087 | if (fl4->flowi4_oif) { | 2087 | if (fl4->flowi4_oif) { |
2088 | dev_out = dev_get_by_index_rcu(net, fl4->flowi4_oif); | 2088 | dev_out = dev_get_by_index_rcu(net, fl4->flowi4_oif); |
2089 | rth = ERR_PTR(-ENODEV); | 2089 | rth = ERR_PTR(-ENODEV); |
2090 | if (dev_out == NULL) | 2090 | if (!dev_out) |
2091 | goto out; | 2091 | goto out; |
2092 | 2092 | ||
2093 | /* RACE: Check return value of inet_select_addr instead. */ | 2093 | /* RACE: Check return value of inet_select_addr instead. */ |
@@ -2299,7 +2299,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, | |||
2299 | u32 metrics[RTAX_MAX]; | 2299 | u32 metrics[RTAX_MAX]; |
2300 | 2300 | ||
2301 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(*r), flags); | 2301 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(*r), flags); |
2302 | if (nlh == NULL) | 2302 | if (!nlh) |
2303 | return -EMSGSIZE; | 2303 | return -EMSGSIZE; |
2304 | 2304 | ||
2305 | r = nlmsg_data(nlh); | 2305 | r = nlmsg_data(nlh); |
@@ -2421,7 +2421,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) | |||
2421 | rtm = nlmsg_data(nlh); | 2421 | rtm = nlmsg_data(nlh); |
2422 | 2422 | ||
2423 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); | 2423 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); |
2424 | if (skb == NULL) { | 2424 | if (!skb) { |
2425 | err = -ENOBUFS; | 2425 | err = -ENOBUFS; |
2426 | goto errout; | 2426 | goto errout; |
2427 | } | 2427 | } |
@@ -2452,7 +2452,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) | |||
2452 | struct net_device *dev; | 2452 | struct net_device *dev; |
2453 | 2453 | ||
2454 | dev = __dev_get_by_index(net, iif); | 2454 | dev = __dev_get_by_index(net, iif); |
2455 | if (dev == NULL) { | 2455 | if (!dev) { |
2456 | err = -ENODEV; | 2456 | err = -ENODEV; |
2457 | goto errout_free; | 2457 | goto errout_free; |
2458 | } | 2458 | } |
@@ -2651,7 +2651,7 @@ static __net_init int sysctl_route_net_init(struct net *net) | |||
2651 | tbl = ipv4_route_flush_table; | 2651 | tbl = ipv4_route_flush_table; |
2652 | if (!net_eq(net, &init_net)) { | 2652 | if (!net_eq(net, &init_net)) { |
2653 | tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); | 2653 | tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); |
2654 | if (tbl == NULL) | 2654 | if (!tbl) |
2655 | goto err_dup; | 2655 | goto err_dup; |
2656 | 2656 | ||
2657 | /* Don't export sysctls to unprivileged users */ | 2657 | /* Don't export sysctls to unprivileged users */ |
@@ -2661,7 +2661,7 @@ static __net_init int sysctl_route_net_init(struct net *net) | |||
2661 | tbl[0].extra1 = net; | 2661 | tbl[0].extra1 = net; |
2662 | 2662 | ||
2663 | net->ipv4.route_hdr = register_net_sysctl(net, "net/ipv4/route", tbl); | 2663 | net->ipv4.route_hdr = register_net_sysctl(net, "net/ipv4/route", tbl); |
2664 | if (net->ipv4.route_hdr == NULL) | 2664 | if (!net->ipv4.route_hdr) |
2665 | goto err_reg; | 2665 | goto err_reg; |
2666 | return 0; | 2666 | return 0; |
2667 | 2667 | ||