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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 05 Jul 2015 15:37:16 +0200
From:	SF Markus Elfring <elfring@...rs.sourceforge.net>
To:	Joel Becker <jlbec@...lplan.org>, Mark Fasheh <mfasheh@...e.com>,
	ocfs2-devel@....oracle.com
CC:	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 08/11] ocfs2: Less checks in ocfs2_load_local_alloc()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 4 Jul 2015 22:06:32 +0200

* Skip checks for the variable "status" in a few cases within
  the ocfs2_load_local_alloc() function by adjustment of two jump targets
  according to the Linux coding style convention.

* Drop unnecessary initialisations for the variables "alloc"
  and "inode" then.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 fs/ocfs2/localalloc.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index e6d5074..08f812b 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -284,14 +284,14 @@ bail:
 int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 {
 	int status = 0;
-	struct ocfs2_dinode *alloc = NULL;
+	struct ocfs2_dinode *alloc;
 	struct buffer_head *alloc_bh = NULL;
 	u32 num_used;
-	struct inode *inode = NULL;
+	struct inode *inode;
 	struct ocfs2_local_alloc *la;
 
-	if (osb->local_alloc_bits == 0)
-		goto bail;
+	if (osb->local_alloc_bits)
+		goto trace_bits;
 
 	if (osb->local_alloc_bits >= osb->bitmap_cpg) {
 		mlog(ML_NOTICE, "Requested local alloc window %d is larger "
@@ -308,14 +308,14 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 	if (!inode) {
 		status = -EINVAL;
 		mlog_errno(status);
-		goto bail;
+		goto trace_bits;
 	}
 
 	status = ocfs2_read_inode_block_full(inode, &alloc_bh,
 					     OCFS2_BH_IGNORE_CACHE);
 	if (status < 0) {
 		mlog_errno(status);
-		goto bail;
+		goto put_inode;
 	}
 
 	alloc = (struct ocfs2_dinode *) alloc_bh->b_data;
@@ -326,6 +326,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 		mlog(ML_ERROR, "Invalid local alloc inode, %llu\n",
 		     (unsigned long long)OCFS2_I(inode)->ip_blkno);
 		status = -EINVAL;
+		mlog_errno(status);
 		goto bail;
 	}
 
@@ -334,6 +335,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 		mlog(ML_ERROR, "Local alloc size is invalid (la_size = %u)\n",
 		     le16_to_cpu(la->la_size));
 		status = -EINVAL;
+		mlog_errno(status);
 		goto bail;
 	}
 
@@ -358,11 +360,10 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
 bail:
 	if (status < 0)
 		brelse(alloc_bh);
+put_inode:
 	iput(inode);
+trace_bits:
 	trace_ocfs2_load_local_alloc(osb->local_alloc_bits);
-
-	if (status)
-		mlog_errno(status);
 	return status;
 }
 
-- 
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ