From: elfring@users.sourceforge.net (SF Markus Elfring)
To: linux-security-module@vger.kernel.org
Subject: [PATCH 4/4] selinux: Adjust five checks for null pointers
Date: Sun, 13 Aug 2017 16:50:07 +0200 [thread overview]
Message-ID: <b74d176c-b028-7e82-80c6-a3014d57d648@users.sourceforge.net> (raw)
In-Reply-To: <e9f47cc9-fda7-dc54-bca9-cae6488914e0@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 13 Aug 2017 16:16:05 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script ?checkpatch.pl? pointed information out like the following.
Comparison to NULL could be written ?
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
security/selinux/ss/ebitmap.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c
index 697bd748760a..c778135989f5 100644
--- a/security/selinux/ss/ebitmap.c
+++ b/security/selinux/ss/ebitmap.c
@@ -96,12 +96,12 @@ int ebitmap_netlbl_export(struct ebitmap *ebmap,
unsigned int iter;
int rc;
- if (e_iter == NULL) {
+ if (!e_iter) {
*catmap = NULL;
return 0;
}
- if (*catmap != NULL)
+ if (*catmap)
netlbl_catmap_free(*catmap);
*catmap = NULL;
@@ -161,14 +161,14 @@ int ebitmap_netlbl_import(struct ebitmap *ebmap,
continue;
}
- if (e_iter == NULL ||
+ if (!e_iter ||
offset >= e_iter->startbit + EBITMAP_SIZE) {
e_prev = e_iter;
e_iter = kmem_cache_zalloc(ebitmap_node_cachep, GFP_ATOMIC);
- if (e_iter == NULL)
+ if (!e_iter)
goto netlbl_import_failure;
e_iter->startbit = offset - (offset % EBITMAP_SIZE);
- if (e_prev == NULL)
+ if (!e_prev)
ebmap->node = e_iter;
else
e_prev->next = e_iter;
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-08-13 14:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-13 14:43 [PATCH 0/4] SELinux: Fine-tuning for some function implementations SF Markus Elfring
2017-08-13 14:45 ` [PATCH 1/4] selinux: Delete eight unnecessary variable assignments SF Markus Elfring
2017-08-13 16:22 ` Serge E. Hallyn
2017-08-13 16:24 ` Serge E. Hallyn
2017-08-13 14:46 ` [PATCH 2/4] selinux: Adjust jump targets in ebitmap_read() SF Markus Elfring
2017-08-13 16:24 ` Serge E. Hallyn
2017-08-13 14:48 ` [PATCH 3/4] selinux: Delete an unnecessary return statement in ebitmap_destroy() SF Markus Elfring
2017-08-13 14:50 ` SF Markus Elfring [this message]
2017-08-13 15:41 ` [PATCH 4/4] selinux: Adjust five checks for null pointers Serge E. Hallyn
2017-08-14 20:59 ` [PATCH 0/4] SELinux: Fine-tuning for some function implementations Paul Moore
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=b74d176c-b028-7e82-80c6-a3014d57d648@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=linux-security-module@vger.kernel.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).