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]
Date:	Thu, 24 Jan 2013 21:53:17 +0100
From:	Paul Bolle <pebolle@...cali.nl>
To:	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Stanislav Kinsbursky <skinsbursky@...allels.com>,
	"J. Bruce Fields" <bfields@...hat.com>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] Silence warning if CONFIG_LOCKDEP isn't set

Since commit c9a4962881929df7f1ef6e63e1b9da304faca4dd ("nfsd: make
client_lock per net") compiling nfs4state.o without CONFIG_LOCKDEP set,
triggers this GCC warning:
    fs/nfsd/nfs4state.c: In function ‘free_client’:
    fs/nfsd/nfs4state.c:1051:19: warning: unused variable ‘nn’ [-Wunused-variable]

The cause of that warning is that lockdep_assert_held() compiles away if
CONFIG_LOCKDEP is not set. Silence this warning by using the argument to
lockdep_assert_held() as a nop if CONFIG_LOCKDEP is not set.

Signed-off-by: Paul Bolle <pebolle@...cali.nl>
---
0) Compile tested only.

1) This patch triggers a checkpatch false positive:
    WARNING: Single statement macros should not use a do {} while (0) loop

2) Review is rather needed here, since I'm not sure what, if any, the
downsides are of this patch for all other "calls" of
lockdep_assert_held(). Besides, a cleaner solution might be to simply
drop lockdep_assert_held() in free_client(). There are only three
callers of that function and it seems obvious that all three do hold
'client_lock'.

 include/linux/lockdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 2bca44b..f05631e 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -410,7 +410,7 @@ struct lock_class_key { };
 
 #define lockdep_depth(tsk)	(0)
 
-#define lockdep_assert_held(l)			do { } while (0)
+#define lockdep_assert_held(l)			do { (void)(l); } while (0)
 
 #define lockdep_recursing(tsk)			(0)
 
-- 
1.7.11.7

--
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