Thread (18 messages) 18 messages, 2 authors, 2018-12-06

Re: [PATCH v8 1/8] arm64: add type casts to untagged_addr macro

flat view

From: Andrey Konovalov <hidden>
Date: 2018-12-06 12:34:43
Also in: linux-arch, linux-doc, linux-kselftest, linux-mm, lkml

On Thu, Nov 29, 2018 at 7:22 PM Catalin Marinas [off-list ref] wrote:
On Thu, Nov 08, 2018 at 03:36:08PM +0100, Andrey Konovalov wrote:
quoted
This patch makes the untagged_addr macro accept all kinds of address types
(void *, unsigned long, etc.) and allows not to specify type casts in each
place where it is used. This is done by using __typeof__.

Signed-off-by: Andrey Konovalov <redacted>
---
 arch/arm64/include/asm/uaccess.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index 07c34087bd5e..c1325271e368 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -101,7 +101,8 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si
  * up with a tagged userland pointer. Clear the tag to get a sane pointer to
  * pass on to access_ok(), for instance.
  */
-#define untagged_addr(addr)          sign_extend64(addr, 55)
+#define untagged_addr(addr)          \
+     ((__typeof__(addr))sign_extend64((__u64)(addr), 55))
Nitpick: same comment as here (use u64):

http://lkml.kernel.org/r/20181123173739.osgvnnhmptdgtlnl@lakrids.cambridge.arm.com
Will do in v9.
Acked-by: Catalin Marinas <catalin.marinas@arm.com>

(not acking the whole series just yet, only specific patches to remember
what I reviewed)
OK.

Thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help