ARM: uaccess: add further explanation of __range_ok()
authorRussell King <rmk+kernel@armlinux.org.uk>
Wed, 22 Jul 2020 08:50:23 +0000 (09:50 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Wed, 22 Jul 2020 08:50:55 +0000 (09:50 +0100)
Detail the success return condition, and that we rely on KERNEL_DS
being zero for this to operate correctly.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/include/asm/uaccess.h

index 98c6b91be4a8addd8212a3f170927e259ffb0e0d..b5fdd30252f845bd36bdc4b3fbced6711d7194b0 100644 (file)
@@ -78,7 +78,11 @@ static inline void set_fs(mm_segment_t fs)
 
 #define segment_eq(a, b)       ((a) == (b))
 
-/* We use 33-bit arithmetic here... */
+/*
+ * We use 33-bit arithmetic here.  Success returns zero, failure returns
+ * addr_limit.  We take advantage that addr_limit will be zero for KERNEL_DS,
+ * so this will always return success in that case.
+ */
 #define __range_ok(addr, size) ({ \
        unsigned long flag, roksum; \
        __chk_user_ptr(addr);   \