diff options
author | kbuild test robot <fengguang.wu@intel.com> | 2018-05-23 06:53:48 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-06-01 03:38:40 -0400 |
commit | 7849958b51aa392e3592b6b8181db0baad979b0b (patch) | |
tree | 6de498f05144d2a1fc8a184026b83470c2bed600 | |
parent | e523452ac0e046d38fcfb7c16748ab8090bf98cd (diff) |
netfilter: fix ptr_ret.cocci warnings
net/netfilter/nft_numgen.c:117:1-3: WARNING: PTR_ERR_OR_ZERO can be used
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")
Fixes: d734a2888922 ("netfilter: nft_numgen: add map lookups for numgen statements")
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | net/netfilter/nft_hash.c | 10 | ||||
-rw-r--r-- | net/netfilter/nft_numgen.c | 5 |
2 files changed, 3 insertions, 12 deletions
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c index f0fc21f88775..c2d237144f74 100644 --- a/net/netfilter/nft_hash.c +++ b/net/netfilter/nft_hash.c | |||
@@ -177,10 +177,7 @@ static int nft_jhash_map_init(const struct nft_ctx *ctx, | |||
177 | priv->map = nft_set_lookup_global(ctx->net, ctx->table, | 177 | priv->map = nft_set_lookup_global(ctx->net, ctx->table, |
178 | tb[NFTA_HASH_SET_NAME], | 178 | tb[NFTA_HASH_SET_NAME], |
179 | tb[NFTA_HASH_SET_ID], genmask); | 179 | tb[NFTA_HASH_SET_ID], genmask); |
180 | if (IS_ERR(priv->map)) | 180 | return PTR_ERR_OR_ZERO(priv->map); |
181 | return PTR_ERR(priv->map); | ||
182 | |||
183 | return 0; | ||
184 | } | 181 | } |
185 | 182 | ||
186 | static int nft_symhash_init(const struct nft_ctx *ctx, | 183 | static int nft_symhash_init(const struct nft_ctx *ctx, |
@@ -220,10 +217,7 @@ static int nft_symhash_map_init(const struct nft_ctx *ctx, | |||
220 | priv->map = nft_set_lookup_global(ctx->net, ctx->table, | 217 | priv->map = nft_set_lookup_global(ctx->net, ctx->table, |
221 | tb[NFTA_HASH_SET_NAME], | 218 | tb[NFTA_HASH_SET_NAME], |
222 | tb[NFTA_HASH_SET_ID], genmask); | 219 | tb[NFTA_HASH_SET_ID], genmask); |
223 | if (IS_ERR(priv->map)) | 220 | return PTR_ERR_OR_ZERO(priv->map); |
224 | return PTR_ERR(priv->map); | ||
225 | |||
226 | return 0; | ||
227 | } | 221 | } |
228 | 222 | ||
229 | static int nft_jhash_dump(struct sk_buff *skb, | 223 | static int nft_jhash_dump(struct sk_buff *skb, |
diff --git a/net/netfilter/nft_numgen.c b/net/netfilter/nft_numgen.c index cdbc62a53933..1f4d0854cf70 100644 --- a/net/netfilter/nft_numgen.c +++ b/net/netfilter/nft_numgen.c | |||
@@ -114,10 +114,7 @@ static int nft_ng_inc_map_init(const struct nft_ctx *ctx, | |||
114 | tb[NFTA_NG_SET_NAME], | 114 | tb[NFTA_NG_SET_NAME], |
115 | tb[NFTA_NG_SET_ID], genmask); | 115 | tb[NFTA_NG_SET_ID], genmask); |
116 | 116 | ||
117 | if (IS_ERR(priv->map)) | 117 | return PTR_ERR_OR_ZERO(priv->map); |
118 | return PTR_ERR(priv->map); | ||
119 | |||
120 | return 0; | ||
121 | } | 118 | } |
122 | 119 | ||
123 | static int nft_ng_dump(struct sk_buff *skb, enum nft_registers dreg, | 120 | static int nft_ng_dump(struct sk_buff *skb, enum nft_registers dreg, |