From: Gao Feng <[email protected]>

The return value of nf_tables_obj_lookup is valid pointer or one error.
There are two cases in nf_tables_newobj totally.
case1: return value is -ENOENT, the obj is NULL, it is unnecessary to
perform the latter check "obj != NULL".
case2: IS_ERR(obj) is false, the obj is one valid pointer. It is also
unnecessary to perform that check.

In summary, we could move the block of condition check "obj != NULL" in
the else block to erase the original condition check.

Signed-off-by: Gao Feng <[email protected]>
---
 net/netfilter/nf_tables_api.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index a019a87..bc55086 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4154,9 +4154,7 @@ static int nf_tables_newobj(struct net *net, struct sock 
*nlsk,
                        return err;
 
                obj = NULL;
-       }
-
-       if (obj != NULL) {
+       } else {
                if (nlh->nlmsg_flags & NLM_F_EXCL)
                        return -EEXIST;
 
-- 
1.9.1


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

Reply via email to