From: Tejun Heo <[email protected]>

lockdep_init_map() only initializes parts of lockdep_map and triggers
kmemcheck warning when it is copied as a whole.  There isn't anything to
be gained by clearing selectively.  memset() the whole structure and
remove loop for ->class_cache[] clearing.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=35532

Signed-off-by: Tejun Heo <[email protected]>
Reported-by: Christian Casteyde <[email protected]>
Tested-by: Christian Casteyde <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 kernel/lockdep.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff -puN kernel/lockdep.c~lockdep-clear-whole-lockdep_map-on-initialization 
kernel/lockdep.c
--- a/kernel/lockdep.c~lockdep-clear-whole-lockdep_map-on-initialization
+++ a/kernel/lockdep.c
@@ -2872,10 +2872,7 @@ static int mark_lock(struct task_struct 
 void lockdep_init_map(struct lockdep_map *lock, const char *name,
                      struct lock_class_key *key, int subclass)
 {
-       int i;
-
-       for (i = 0; i < NR_LOCKDEP_CACHING_CLASSES; i++)
-               lock->class_cache[i] = NULL;
+       memset(lock, 0, sizeof(*lock));
 
 #ifdef CONFIG_LOCK_STAT
        lock->cpu = raw_smp_processor_id();
_

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to