Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fadf0464 authored by Jason Baron's avatar Jason Baron Committed by Ingo Molnar
Browse files

jump label: Add a WARN() if jump label key count goes negative



The count on a jump label key should never go negative. Add a
WARN() to check for this condition.

Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: rostedt@goodmis.org
Cc: mathieu.desnoyers@efficios.com
Cc: davem@davemloft.net
Cc: ddaney.cavm@gmail.com
Cc: a.p.zijlstra@chello.nl
Link: http://lkml.kernel.org/r/3c68556121be4d1920417a3fe367da1ec38246b4.1329851692.git.jbaron@redhat.com


Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 09bda443
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);