]> www.infradead.org Git - users/jedix/linux-maple.git/commit
MIPS: fix truncation in __cmpxchg_small for short values
authorMichael Clark <michaeljclark@mac.com>
Mon, 11 Feb 2019 04:38:29 +0000 (17:38 +1300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Mar 2019 16:58:03 +0000 (17:58 +0100)
commit8b1852c5d2c0e406792b898c5ee1f39762c22c9d
treea057b1023f0c8c61191fa8ce9832920c52dab36b
parentf5817069248630b3b7b17ebfcdee0b679c52be33
MIPS: fix truncation in __cmpxchg_small for short values

commit 94ee12b507db8b5876e31c9d6c9d84f556a4b49f upstream.

__cmpxchg_small erroneously uses u8 for load comparison which can
be either char or short. This patch changes the local variable to
u32 which is sufficiently sized, as the loaded value is already
masked and shifted appropriately. Using an integer size avoids
any unnecessary canonicalization from use of non native widths.

This patch is part of a series that adapts the MIPS small word
atomics code for xchg and cmpxchg on short and char to RISC-V.

Cc: RISC-V Patches <patches@groups.riscv.org>
Cc: Linux RISC-V <linux-riscv@lists.infradead.org>
Cc: Linux MIPS <linux-mips@linux-mips.org>
Signed-off-by: Michael Clark <michaeljclark@mac.com>
[paul.burton@mips.com:
  - Fix varialble typo per Jonas Gorski.
  - Consolidate load variable with other declarations.]
Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: 3ba7f44d2b19 ("MIPS: cmpxchg: Implement 1 byte & 2 byte cmpxchg()")
Cc: stable@vger.kernel.org # v4.13+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/mips/kernel/cmpxchg.c