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]
Message-Id: <1389468763-25662-1-git-send-email-monamagarwal123@gmail.com>
Date:	Sun, 12 Jan 2014 01:02:43 +0530
From:	Monam Agarwal <monamagarwal123@...il.com>
To:	gregkh@...uxfoundation.org, monamagarwal123@...il.com,
	andreas.dilger@...el.com, peter.p.waskiewicz.jr@...el.com,
	tao.peng@....com, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v2] Staging: lustre: Use of fls to find last set bit

This introduces fls in lustre/ldlm/ldlm_extent.c 
to find the last set bit. 

It also fixes the following checkpatch.pl warning in
lustre/ldlm/ldlm_extent.c
WARNING: space prohibited before semicolon.

The patch also fixes the following checkpatch.pl error in
lustre/ldlm/ldlm_extent.c
ERROR: trailing statements should be on next line


Signed-off-by: Monam Agarwal <monamagarwal123@...il.com>
---
Changes since v1:
*Incorrect commit message
*Use of fls function

 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
index ac5d66a..e6fe2cb 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
@@ -150,10 +150,12 @@ struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l)
 static inline int lock_mode_to_index(ldlm_mode_t mode)
 {
 	int index;
+	int len;
 
 	LASSERT(mode != 0);
 	LASSERT(IS_PO2(mode));
-	for (index = -1; mode; index++, mode >>= 1) ;
+	len = fls(mode);
+	index = len-1;
 	LASSERT(index < LCK_MODE_NUM);
 	return index;
 }
-- 
1.7.9.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