Skip to content

Commit

Permalink
lockdep: fix overflow in the hlock shrinkage code
Browse files Browse the repository at this point in the history
There is a overflow by 1 case in the new shrunken hlock code.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Aug 11, 2008
1 parent 3295f0e commit b42e737
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/linux/lockdep.h
Original file line number Diff line number Diff line change
@@ -191,7 +191,12 @@ struct lock_chain {
};

#define MAX_LOCKDEP_KEYS_BITS 11
#define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS)
/*
* Subtract one because we offset hlock->class_idx by 1 in order
* to make 0 mean no class. This avoids overflowing the class_idx
* bitfield and hitting the BUG in hlock_class().
*/
#define MAX_LOCKDEP_KEYS ((1UL << MAX_LOCKDEP_KEYS_BITS) - 1)

struct held_lock {
/*

0 comments on commit b42e737

Please sign in to comment.