From: Russell King Date: Wed, 22 Jul 2020 08:50:23 +0000 (+0100) Subject: ARM: uaccess: add further explanation of __range_ok() X-Git-Tag: v5.9-rc1~129^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2350ebe2c40dfc2a0830e5eab17976d83f594ded;p=thirdparty%2Fkernel%2Flinux.git ARM: uaccess: add further explanation of __range_ok() Detail the success return condition, and that we rely on KERNEL_DS being zero for this to operate correctly. Signed-off-by: Russell King --- diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 98c6b91be4a8a..b5fdd30252f84 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -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); \