From 85ac2bcd0736253908ada3c52857261bc234d83a Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 3 Aug 2011 10:52:34 +1000 Subject: [PATCH] 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 Reported-by: Christian Casteyde Tested-by: Christian Casteyde Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Signed-off-by: Andrew Morton --- kernel/lockdep.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/lockdep.c b/kernel/lockdep.c index e60e73ed9b5b..8a8587ce93d8 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c @@ -2872,10 +2872,7 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this, 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(); -- 2.39.5