[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1461203176.1918.3.camel@perches.com>
Date: Wed, 20 Apr 2016 18:46:16 -0700
From: Joe Perches <joe@...ches.com>
To: Gustavo Padovan <gustavo@...ovan.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
dri-devel@...ts.freedesktop.org,
Daniel Stone <daniels@...labora.com>,
Arve Hjønnevåg <arve@...roid.com>,
Riley Andrews <riandrews@...roid.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Rob Clark <robdclark@...il.com>,
Greg Hackmann <ghackmann@...gle.com>,
John Harrison <John.C.Harrison@...el.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Gustavo Padovan <gustavo.padovan@...labora.co.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel.vetter@...el.com>
Subject: Re: [PATCH 2/3] kernel.h: add u64_to_user_ptr()
On Wed, 2016-04-20 at 16:18 -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@...labora.co.uk>
>
> This function had copies in 3 different files. Unify them in kernel.h.
[]
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
[]
> @@ -53,6 +53,12 @@
>
> #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>
> +static inline void __user *u64_to_user_ptr(u64 address)
> +{
> + typecheck(u64, address);
> + return (void __user *)(uintptr_t)address;
> +}
> +
This won't work because by the time address is checked
address is already u64
This would need to be something like
#define u64_to_user_ptr(x) \
({ \
typecheck(u64, x); \
u64_to_user_ptr(x); \
})
Powered by blists - more mailing lists