diff mbox series

netfilter: nft_hash: fix ptr_ret.cocci warnings

Message ID 20180523105348.GA69336@roam
State Accepted
Delegated to: Pablo Neira
Headers show
Series netfilter: nft_hash: fix ptr_ret.cocci warnings | expand

Commit Message

kbuild test robot May 23, 2018, 10:53 a.m. UTC
From: kbuild test robot <fengguang.wu@intel.com>

net/netfilter/nft_hash.c:180:1-3: WARNING: PTR_ERR_OR_ZERO can be used
net/netfilter/nft_hash.c:223:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: b9ccc07e3f31 ("netfilter: nft_hash: add map lookups for hashing operations")
CC: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

 nft_hash.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

nevola May 24, 2018, 10:39 a.m. UTC | #1
On Wed, May 23, 2018 at 12:53 PM, kbuild test robot
<fengguang.wu@intel.com> wrote:
> From: kbuild test robot <fengguang.wu@intel.com>
>
> net/netfilter/nft_hash.c:180:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> net/netfilter/nft_hash.c:223:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
>
>  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
>
> Fixes: b9ccc07e3f31 ("netfilter: nft_hash: add map lookups for hashing operations")
> CC: Laura Garcia Liebana <nevola@gmail.com>
> Signed-off-by: kbuild test robot <fengguang.wu@intel.com>

Acked-by: Laura Garcia Liebana <nevola@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -177,10 +177,7 @@  static int nft_jhash_map_init(const stru
 	priv->map = nft_set_lookup_global(ctx->net, ctx->table,
 					  tb[NFTA_HASH_SET_NAME],
 					  tb[NFTA_HASH_SET_ID], genmask);
-	if (IS_ERR(priv->map))
-		return PTR_ERR(priv->map);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(priv->map);
 }
 
 static int nft_symhash_init(const struct nft_ctx *ctx,
@@ -220,10 +217,7 @@  static int nft_symhash_map_init(const st
 	priv->map = nft_set_lookup_global(ctx->net, ctx->table,
 					  tb[NFTA_HASH_SET_NAME],
 					  tb[NFTA_HASH_SET_ID], genmask);
-	if (IS_ERR(priv->map))
-		return PTR_ERR(priv->map);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(priv->map);
 }
 
 static int nft_jhash_dump(struct sk_buff *skb,