As recently suggested, this patch arms the __must_check logic behind
__xn_copy_to_user, __xn_copy_from_user (not on i386 due to lacking
instrumentation of Linux service), __xn_strncpy_from_user.

This patch is only intended to point out what remains to be addressed,
the huge number of warnings make it unsuited form a merge at this -rc stage.

Jan
---
 include/asm-generic/wrappers.h |    4 ++++
 include/asm-x86/hal.h          |    4 ++++
 include/asm-x86/hal_32.h       |    2 --
 include/asm-x86/hal_64.h       |    4 ----
 include/asm-x86/syscall_32.h   |   11 ++++-------
 include/asm-x86/syscall_64.h   |   11 ++++-------
 6 files changed, 16 insertions(+), 20 deletions(-)

Index: xenomai/include/asm-x86/hal.h
===================================================================
--- xenomai.orig/include/asm-x86/hal.h
+++ xenomai/include/asm-x86/hal.h
@@ -46,4 +46,8 @@ extern enum rthal_ktimer_mode rthal_ktim
 #include "hal_64.h"
 #endif
 
+long __must_check rthal_strncpy_from_user(char *dst,
+					  const char __user *src,
+					  long count);
+
 #endif /* !_XENO_ASM_X86_HAL_H */
Index: xenomai/include/asm-x86/hal_32.h
===================================================================
--- xenomai.orig/include/asm-x86/hal_32.h
+++ xenomai/include/asm-x86/hal_32.h
@@ -222,8 +222,6 @@ static inline void rthal_setup_oneshot_a
 
 #endif /* !__cplusplus */
 
-long rthal_strncpy_from_user(char *dst, const char __user * src, long count);
-
 void rthal_latency_above_max(struct pt_regs *regs);
 
 #endif /* !_XENO_ASM_X86_HAL_32_H */
Index: xenomai/include/asm-x86/hal_64.h
===================================================================
--- xenomai.orig/include/asm-x86/hal_64.h
+++ xenomai/include/asm-x86/hal_64.h
@@ -138,8 +138,4 @@ static inline void rthal_setup_oneshot_a
 
 #endif /* !__cplusplus */
 
-long rthal_strncpy_from_user(char *dst,
-			     const char __user *src,
-			     long count);
-
 #endif /* !_XENO_ASM_X86_HAL_64_H */
Index: xenomai/include/asm-x86/syscall_32.h
===================================================================
--- xenomai.orig/include/asm-x86/syscall_32.h
+++ xenomai/include/asm-x86/syscall_32.h
@@ -47,13 +47,10 @@
 #define __xn_mux_op(regs)     ((__xn_reg_mux(regs) >> 24) & 0xff)
 
 /* Our own set of copy-to/from-user macros which must bypass
-   might_sleep() checks. The caller cannot fault and is expected to
-   have checked for bad range before using the copy macros, so we
-   should not have to care about the result. */
-#define __xn_copy_from_user(task,dstP,srcP,n)  \
-    ({ int __err__ = __copy_from_user_inatomic(dstP,srcP,n); __err__; })
-#define __xn_copy_to_user(task,dstP,srcP,n)  \
-    ({ int __err__ = __copy_to_user_inatomic(dstP,srcP,n); __err__; })
+   might_sleep() checks. The caller is expected to have checked
+   for bad range before using the copy macros. */
+#define __xn_copy_from_user(task,dstP,srcP,n)  __copy_from_user_inatomic(dstP,srcP,n)
+#define __xn_copy_to_user(task,dstP,srcP,n)    __copy_to_user_inatomic(dstP,srcP,n)
 #define __xn_put_user(task,src,dstP)           __put_user(src,dstP)
 #define __xn_get_user(task,dst,srcP)           __get_user(dst,srcP)
 #define __xn_strncpy_from_user(task,dstP,srcP,n)    wrap_strncpy_from_user(dstP,srcP,n)
Index: xenomai/include/asm-x86/syscall_64.h
===================================================================
--- xenomai.orig/include/asm-x86/syscall_64.h
+++ xenomai/include/asm-x86/syscall_64.h
@@ -47,13 +47,10 @@
 #define __xn_mux_op(regs)     ((__xn_reg_mux(regs) >> 24) & 0xff)
 
 /* Our own set of copy-to/from-user macros which must bypass
-   might_sleep() checks. The caller cannot fault and is expected to
-   have checked for bad range before using the copy macros, so we
-   should not have to care about the result. */
-#define __xn_copy_from_user(task,dstP,srcP,n)  \
-    ({ int __err__ = __copy_from_user_inatomic(dstP,srcP,n); __err__; })
-#define __xn_copy_to_user(task,dstP,srcP,n)  \
-    ({ int __err__ = __copy_to_user_inatomic(dstP,srcP,n); __err__; })
+   might_sleep() checks. The caller is expected to have checked
+   for bad range before using the copy macros. */
+#define __xn_copy_from_user(task,dstP,srcP,n)	__copy_from_user_inatomic(dstP,srcP,n)
+#define __xn_copy_to_user(task,dstP,srcP,n)	__copy_to_user_inatomic(dstP,srcP,n)
 #define __xn_put_user(task,src,dstP)		__put_user(src,dstP)
 #define __xn_get_user(task,dst,srcP)		__get_user(dst,srcP)
 #define __xn_strncpy_from_user(task,dstP,srcP,n) rthal_strncpy_from_user(dstP,srcP,n)
Index: xenomai/include/asm-generic/wrappers.h
===================================================================
--- xenomai.orig/include/asm-generic/wrappers.h
+++ xenomai/include/asm-generic/wrappers.h
@@ -183,6 +183,10 @@ void show_stack(struct task_struct *task
 #define __deprecated  __attribute__((deprecated))
 #endif
 
+#ifndef __must_check
+#define __must_check
+#endif
+
 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) */
 
 #define compat_module_param_array(name, type, count, perm) \

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to