Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715384

[PATCH 3/3] jffs2: Adjust a null pointer check in two functions

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 3/3] jffs2: Adjust a null pointer check in two functions
Date 2017-08-18 21:10 +0200
Message-ID <ufUOC-7Rd-9@gated-at.bofh.it> (permalink)
References <ufUOB-7Rd-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 18 Aug 2017 20:40:35 +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 the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/jffs2/nodemgmt.c | 3 +--
 fs/jffs2/security.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index a7bbe879cfc3..d5346ba782f7 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -242,8 +242,7 @@ int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
 
 static void jffs2_close_nextblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
 {
-
-	if (c->nextblock == NULL) {
+	if (!c->nextblock) {
 		jffs2_dbg(1, "%s(): Erase block at 0x%08x has already been placed in a list\n",
 			  __func__, jeb->offset);
 		return;
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c
index c2332e30f218..9859b522721f 100644
--- a/fs/jffs2/security.c
+++ b/fs/jffs2/security.c
@@ -29,7 +29,7 @@ static int jffs2_initxattrs(struct inode *inode,
 	const struct xattr *xattr;
 	int err = 0;
 
-	for (xattr = xattr_array; xattr->name != NULL; xattr++) {
+	for (xattr = xattr_array; xattr->name; xattr++) {
 		err = do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY,
 					xattr->name, xattr->value,
 					xattr->value_len, 0);
-- 
2.14.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] JFFS2: Adjustments for seven function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-18 21:10 +0200
  [PATCH 3/3] jffs2: Adjust a null pointer check in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-18 21:10 +0200
  [PATCH 2/3] jffs2: Improve a size determination in  jffs2_scan_medium() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-18 21:10 +0200
  [PATCH 1/3] jffs2: Delete an error message for a failed memory  allocation in four functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-18 21:10 +0200

csiph-web