From: simran singhal <singhalsimran0@gmail.com>
To: pablo@netfilter.org
Cc: kadlec@blackhole.kfki.hu, davem@davemloft.net,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
gregkh@linuxfoundation.org, outreachy-kernel@googlegroups.com
Subject: [PATCH 4/5] netfilter: nfnetlink: Clean up tests if NULL returned on failure
Date: Tue, 21 Mar 2017 14:14:38 +0530 [thread overview]
Message-ID: <1490085879-1827-5-git-send-email-singhalsimran0@gmail.com> (raw)
In-Reply-To: <1490085879-1827-1-git-send-email-singhalsimran0@gmail.com>
Some functions like kmalloc/kzalloc return NULL on failure. When NULL
represents failure, !x is commonly used.
This was done using Coccinelle:
@@
expression *e;
identifier l1;
@@
e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(...);
...
- e == NULL
+ !e
Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
--This is my contribution to the netfilter project of
Outreachy Round 14.
net/netfilter/nfnetlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 68eda920..c39f16c 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -232,7 +232,7 @@ static int nfnl_err_add(struct list_head *list, struct nlmsghdr *nlh, int err)
struct nfnl_err *nfnl_err;
nfnl_err = kmalloc(sizeof(struct nfnl_err), GFP_KERNEL);
- if (nfnl_err == NULL)
+ if (!nfnl_err)
return -ENOMEM;
nfnl_err->nlh = nlh;
--
2.7.4
next prev parent reply other threads:[~2017-03-21 8:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-21 8:44 [PATCH 0/5] netfilter: Clean up tests if NULL returned on failure simran singhal
2017-03-21 8:44 ` [PATCH 1/5] netfilter: ipvs: " simran singhal
2017-03-21 8:44 ` [PATCH 2/5] netfilter: " simran singhal
2017-03-21 8:44 ` [PATCH 3/5] netfilter: nf_tables_api: " simran singhal
2017-03-21 8:44 ` simran singhal [this message]
2017-03-21 8:44 ` [PATCH 5/5] netfilter: xt_TEE: " simran singhal
2017-03-22 13:38 ` [PATCH 0/5] netfilter: " Pablo Neira Ayuso
2017-03-22 13:45 ` SIMRAN SINGHAL
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1490085879-1827-5-git-send-email-singhalsimran0@gmail.com \
--to=singhalsimran0@gmail.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=kadlec@blackhole.kfki.hu \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.