Thread (8 messages) 8 messages, 4 authors, 2022-11-14

Re: [PATCH v3 1/3] jump_label: Prevent key->enabled int overflow

From: Dmitry Safonov <hidden>
Date: 2022-11-14 17:14:04
Also in: lkml

On 11/14/22 16:24, Jason Baron wrote:
[..]
quoted
@@ -148,16 +167,23 @@ void static_key_slow_inc_cpuslocked(struct static_key *key)
 		 */
 		atomic_set_release(&key->enabled, 1);
 	} else {
-		atomic_inc(&key->enabled);
+		if (WARN_ON_ONCE(static_key_fast_inc(key))) {
Shouldn't that be negated to catch the overflow:

if (WARN_ON_ONCE(!static_key_fast_inc(key)))
Oh, that's just embarrassing!
I wonder how did I miss it during tests..

Thanks for spotting this, will fix in v4,
            Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help