lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <056c8b8e-abaa-8856-4953-118d14048ddc@web.de>
Date:   Tue, 3 Sep 2019 19:20:49 +0200
From:   Markus Elfring <Markus.Elfring@....de>
To:     kernel-janitors@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>,
        Anders Larsen <al@...rsen.net>,
        Deepa Dinamani <deepa.kernel@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jeff Layton <jlayton@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] fs/qnx: Delete unnecessary checks before brelse()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 3 Sep 2019 19:15:09 +0200

The brelse() function tests whether its argument is NULL
and then returns immediately.
Thus the tests around the shown calls are not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 fs/qnx4/inode.c | 3 +--
 fs/qnx6/inode.c | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index e8da1cde87b9..018a4c657f7c 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -118,8 +118,7 @@ unsigned long qnx4_block_map( struct inode *inode, long iblock )
 				bh = NULL;
 			}
 		}
-		if ( bh )
-			brelse( bh );
+		brelse(bh);
 	}

 	QNX4DEBUG((KERN_INFO "qnx4: mapping block %ld of inode %ld = %ld\n",iblock,inode->i_ino,block));
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 345db56c98fd..083170541add 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -472,10 +472,8 @@ static int qnx6_fill_super(struct super_block *s, void *data, int silent)
 out1:
 	iput(sbi->inodes);
 out:
-	if (bh1)
-		brelse(bh1);
-	if (bh2)
-		brelse(bh2);
+	brelse(bh1);
+	brelse(bh2);
 outnobh:
 	kfree(qs);
 	s->s_fs_info = NULL;
--
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ