Skip to content

Commit b33d59f

Browse files
committed
s390/uaccess: avoid __ashlti3() call
__cmpxchg_user_key() uses 128 bit types which, depending on compiler and config options, may lead to an __ashlti3() library call. Get rid of that by simply casting the 128 bit values to 32 bit values. Reported-by: kernel test robot <[email protected]> Suggested-by: Janis Schoetterl-Glausch <[email protected]> Fixes: 51098f0 ("s390/cmpxchg: make loop condition for 1,2 byte cases precise") Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Heiko Carstens <[email protected]>
1 parent 739ad2e commit b33d59f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/s390/include/asm/uaccess.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ static __always_inline int __cmpxchg_user_key(unsigned long address, void *uval,
407407

408408
shift = (3 ^ (address & 3)) << 3;
409409
address ^= address & 3;
410-
_old = (old & 0xff) << shift;
411-
_new = (new & 0xff) << shift;
410+
_old = ((unsigned int)old & 0xff) << shift;
411+
_new = ((unsigned int)new & 0xff) << shift;
412412
mask = ~(0xff << shift);
413413
asm volatile(
414414
" spka 0(%[key])\n"
@@ -455,8 +455,8 @@ static __always_inline int __cmpxchg_user_key(unsigned long address, void *uval,
455455

456456
shift = (2 ^ (address & 2)) << 3;
457457
address ^= address & 2;
458-
_old = (old & 0xffff) << shift;
459-
_new = (new & 0xffff) << shift;
458+
_old = ((unsigned int)old & 0xffff) << shift;
459+
_new = ((unsigned int)new & 0xffff) << shift;
460460
mask = ~(0xffff << shift);
461461
asm volatile(
462462
" spka 0(%[key])\n"

0 commit comments

Comments
 (0)