Skip to content

Commit

Permalink
jump label: Add a WARN() if jump label key count goes negative
Browse files Browse the repository at this point in the history
The count on a jump label key should never go negative. Add a
WARN() to check for this condition.

Signed-off-by: Jason Baron <[email protected]>
Cc: Gleb Natapov <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/3c68556121be4d1920417a3fe367da1ec38246b4.1329851692.git.jbaron@redhat.com
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
jibaron authored and Ingo Molnar committed Feb 22, 2012
1 parent 09bda44 commit fadf046
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/jump_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ EXPORT_SYMBOL_GPL(jump_label_inc);
static void __jump_label_dec(struct jump_label_key *key,
unsigned long rate_limit, struct delayed_work *work)
{
if (!atomic_dec_and_mutex_lock(&key->enabled, &jump_label_mutex))
if (!atomic_dec_and_mutex_lock(&key->enabled, &jump_label_mutex)) {
WARN(atomic_read(&key->enabled) < 0,
"jump label: negative count!\n");
return;
}

if (rate_limit) {
atomic_inc(&key->enabled);
Expand Down

0 comments on commit fadf046

Please sign in to comment.