lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 13 Aug 2017 16:50:07 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-security-module@...r.kernel.org, selinux@...ho.nsa.gov,
        Alexey Dobriyan <adobriyan@...il.com>,
        Daniel Jurgens <danielj@...lanox.com>,
        Eric Paris <eparis@...isplace.org>,
        James Morris <james.l.morris@...cle.com>,
        Junil Lee <junil0814.lee@....com>,
        Paul Moore <paul@...l-moore.com>,
        "Serge E. Hallyn" <serge@...lyn.com>,
        Stephen Smalley <sds@...ho.nsa.gov>,
        William Roberts <william.c.roberts@...el.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 4/4] selinux: Adjust five checks for null pointers

From: Markus Elfring <elfring@...rs.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@...rs.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux - Powered by OpenVZ