]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: cmpxchg: Error out on unsupported xchg() calls
authorPaul Burton <paul.burton@imgtec.com>
Sat, 10 Jun 2017 00:26:36 +0000 (17:26 -0700)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 29 Jun 2017 00:42:24 +0000 (02:42 +0200)
commitf730ab8fb45908a6e32461b9fb53157e813b9ea5
tree3d15ad84f49c8d9735298f4f4915dd7a5e7f69d3
parent29ef5a816457fcf77ae640805674cd2e1b49ca39
MIPS: cmpxchg: Error out on unsupported xchg() calls

xchg() has up until now simply returned the x parameter in cases where
it is called with a pointer to a value of an unsupported size. This will
often cause the calling code to hit a failure path, presuming that the
value of x differs from the content of the memory pointed at by ptr, but
we can do better by producing a compile-time or link-time error such
that unsupported calls to xchg() are detectable earlier than runtime.

This patch does this in the same was as is already done for cmpxchg(),
using a call to a missing function annotated with __compiletime_error().

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16351/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/cmpxchg.h