[PATCH v6 20/21] all: s390: make compat wrappers the generic solution
Yury Norov
ynorov at caviumnetworks.com
Thu Jan 14 10:11:43 PST 2016
On Thu, Jan 14, 2016 at 08:23:17PM +0300, Yury Norov wrote:
> The problem that makes us to use wrappers is that some compat
> architectures allows user code to access top halves of registers.
> This is not a problem for syscalls that are already handled by compat
> code, or for that who has types of the same size in kernel and
> userspace. In case of lp64/ilp32 the problem is in pointer types, long,
> unsigned long.
>
> S390 folks already have the solution for it. In this patch,
> it is turned to be general, as arm64/ilp32 needs it too.
>
> Build-tested on s390.
>
> Signed-off-by: Yury Norov <ynorov at caviumnetworks.com>
> ---
[...]
> +#ifndef __SC_COMPAT_CAST
> +#define __SC_COMPAT_CAST(t, a) ((t)(long) ((t)(-1) < 0 ? (s32)(a) : (u32)(a)))
> +#endif
It should be like:
#define __SC_COMPAT_CAST(t, a) ((t) ((t)(-1) < 0 ? (s64)(s32)(a) : (u64)(u32)(a)))
More information about the linux-arm-kernel
mailing list