On Fri, Jan 6, 2017 at 9:49 AM, <fgao@xxxxxxxxxx> wrote: > From: Gao Feng <fgao@xxxxxxxxxx> > > 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 <fgao@xxxxxxxxxx> > --- > 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 > > Hi all, Please ignore this patch. Because I find the nf_tables_newtable and nf_tables_newset have same logic, so I update them too, and send another patch. The link is https://patchwork.ozlabs.org/patch/713533/. Regards Feng -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html