Skip to contentSkip to conversation

ia64 basic __user annotations

PATCH In review Al Viro 2 participants 2 messages Sep 28, 2005 – Sep 29, 2005

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 ia64 basic __user annotations

* document places where we pass kernel address to low-level
primitive that deals with kernel/user addresses
* uintptr_t is unsigned long, not long

----

include/asm-ia64/uaccess.h +6 -6
diff -urN RC14-rc2-git6-armv-iomem/include/asm-ia64/uaccess.h RC14-rc2-git6-ia64-user/include/asm-ia64/uaccess.h
@@ -187,8 +187,8 @@
 ({											\
 	const __typeof__(*(ptr)) __user *__gu_ptr = (ptr);				\
 	__typeof__ (size) __gu_size = (size);						\
-	long __gu_err = -EFAULT, __gu_val = 0;						\
-											\
+	long __gu_err = -EFAULT;							\
+	unsigned long __gu_val = 0;							\
 	if (!check || __access_ok(__gu_ptr, size, segment))				\
 		switch (__gu_size) {							\
 		      case 1: __get_user_size(__gu_val, __gu_ptr, 1, __gu_err); break;	\
@@ -240,13 +240,13 @@
 static inline unsigned long
 __copy_to_user (void __user *to, const void *from, unsigned long count)
 {
-	return __copy_user(to, (void __user *) from, count);
+	return __copy_user(to, (__force void __user *) from, count);
 }
 
 static inline unsigned long
 __copy_from_user (void *to, const void __user *from, unsigned long count)
 {
-	return __copy_user((void __user *) to, from, count);
+	return __copy_user((__force void __user *) to, from, count);
 }
 
 #define __copy_to_user_inatomic		__copy_to_user
@@ -258,7 +258,7 @@
 	long __cu_len = (n);								\
 											\
 	if (__access_ok(__cu_to, __cu_len, get_fs()))					\
-		__cu_len = __copy_user(__cu_to, (void __user *) __cu_from, __cu_len);	\
+		__cu_len = __copy_user(__cu_to, (__force void __user *) __cu_from, __cu_len);	\
 	__cu_len;									\
 })
 
@@ -270,7 +270,7 @@
 											\
 	__chk_user_ptr(__cu_from);							\
 	if (__access_ok(__cu_from, __cu_len, get_fs()))					\
-		__cu_len = __copy_user((void __user *) __cu_to, __cu_from, __cu_len);	\
+		__cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len);	\
 	__cu_len;									\
 })
 
#1 lore raw

include/asm-ia64/uaccess.h line 191

Quoted 6 lines · Al Viro

* uintptr_t is unsigned long, not long

include/asm-ia64/uaccess.h +2 -2
-       long __gu_err = -EFAULT, __gu_val = 0;                                          \
-                                                                                       \
+       long __gu_err = -EFAULT;                                                        \
+       unsigned long __gu_val = 0;                                                     \

Too subtle for me ... what's happening here? If you change this, then should you also change "register long __gu_r9 asm ("r9");" in __get_user_size to be unsigned long as well?

-Tony