Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

futex: futex_wake_op, fix sign_extend32 sign bits

sign_extend32 counts the sign bit parameter from 0, not from 1. So we
have to use "11" for 12th bit, not "12".

This mistake means we have not allowed negative op and cmp args since
commit 30d6e0a4190d ("futex: Remove duplicated code and fix undefined
behaviour") till now.

Fixes: 30d6e0a4190d ("futex: Remove duplicated code and fix undefined behaviour")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Darren Hart <dvhart@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jiri Slaby and committed by
Linus Torvalds
d70ef228 51090c5d

+2 -2
+2 -2
kernel/futex.c
··· 1582 1582 { 1583 1583 unsigned int op = (encoded_op & 0x70000000) >> 28; 1584 1584 unsigned int cmp = (encoded_op & 0x0f000000) >> 24; 1585 - int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 12); 1586 - int cmparg = sign_extend32(encoded_op & 0x00000fff, 12); 1585 + int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 11); 1586 + int cmparg = sign_extend32(encoded_op & 0x00000fff, 11); 1587 1587 int oldval, ret; 1588 1588 1589 1589 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) {