]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
netfilter: x_tables: simplify IS_ERR_OR_NULL to NULL test
authorJulia Lawall <julia.lawall@lip6.fr>
Fri, 11 Nov 2016 12:32:38 +0000 (13:32 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 13 Nov 2016 21:26:13 +0000 (22:26 +0100)
commiteb1a6bdc28268afa964e4c9f3399961dff9fd691
tree65f4441a51bb69fa64b659bfe64a3d53c066a2bd
parent7e416ad7416307e22871a0ef0f0f14e2bb66a0d1
netfilter: x_tables: simplify IS_ERR_OR_NULL to NULL test

Since commit 7926dbfa4bc1 ("netfilter: don't use
mutex_lock_interruptible()"), the function xt_find_table_lock can only
return NULL on an error.  Simplify the call sites and update the
comment before the function.

The semantic patch that change the code is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression t,e;
@@

t = \(xt_find_table_lock(...)\|
      try_then_request_module(xt_find_table_lock(...),...)\)
... when != t=e
- ! IS_ERR_OR_NULL(t)
+ t

@@
expression t,e;
@@

t = \(xt_find_table_lock(...)\|
      try_then_request_module(xt_find_table_lock(...),...)\)
... when != t=e
- IS_ERR_OR_NULL(t)
+ !t

@@
expression t,e,e1;
@@

t = \(xt_find_table_lock(...)\|
      try_then_request_module(xt_find_table_lock(...),...)\)
... when != t=e
?- t ? PTR_ERR(t) : e1
+ e1
... when any

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c
net/netfilter/x_tables.c