Skip to content

Commit 7849958

Browse files
kbuild test robotummakynes
authored andcommitted
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: b9ccc07 ("netfilter: nft_hash: add map lookups for hashing operations") Fixes: d734a28 ("netfilter: nft_numgen: add map lookups for numgen statements") CC: Laura Garcia Liebana <[email protected]> Signed-off-by: kbuild test robot <[email protected]> Acked-by: Laura Garcia Liebana <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent e523452 commit 7849958

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

net/netfilter/nft_hash.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ static int nft_jhash_map_init(const struct nft_ctx *ctx,
177177
priv->map = nft_set_lookup_global(ctx->net, ctx->table,
178178
tb[NFTA_HASH_SET_NAME],
179179
tb[NFTA_HASH_SET_ID], genmask);
180-
if (IS_ERR(priv->map))
181-
return PTR_ERR(priv->map);
182-
183-
return 0;
180+
return PTR_ERR_OR_ZERO(priv->map);
184181
}
185182

186183
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,
220217
priv->map = nft_set_lookup_global(ctx->net, ctx->table,
221218
tb[NFTA_HASH_SET_NAME],
222219
tb[NFTA_HASH_SET_ID], genmask);
223-
if (IS_ERR(priv->map))
224-
return PTR_ERR(priv->map);
225-
226-
return 0;
220+
return PTR_ERR_OR_ZERO(priv->map);
227221
}
228222

229223
static int nft_jhash_dump(struct sk_buff *skb,

net/netfilter/nft_numgen.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ static int nft_ng_inc_map_init(const struct nft_ctx *ctx,
114114
tb[NFTA_NG_SET_NAME],
115115
tb[NFTA_NG_SET_ID], genmask);
116116

117-
if (IS_ERR(priv->map))
118-
return PTR_ERR(priv->map);
119-
120-
return 0;
117+
return PTR_ERR_OR_ZERO(priv->map);
121118
}
122119

123120
static int nft_ng_dump(struct sk_buff *skb, enum nft_registers dreg,

0 commit comments

Comments
 (0)