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 5/5] netfilter: xt_TEE: Clean up tests if NULL returned on failure
Date: Tue, 21 Mar 2017 14:14:39 +0530 [thread overview]
Message-ID: <1490085879-1827-6-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/xt_TEE.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index 86b0580..5df3282 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -95,7 +95,7 @@ static int tee_tg_check(const struct xt_tgchk_param *par)
return -EINVAL;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (priv == NULL)
+ if (!priv)
return -ENOMEM;
priv->tginfo = info;
--
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 ` [PATCH 4/5] netfilter: nfnetlink: " simran singhal
2017-03-21 8:44 ` simran singhal [this message]
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-6-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).