All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Xenomai-core@domain.hid
Subject: [Xenomai-core] [RFC][PATCH 5/5] Report ignored __xn_copy_*_user return codes
Date: Tue, 13 Nov 2007 00:01:33 +0100	[thread overview]
Message-ID: <4738DB4D.1020703@domain.hid> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 357 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: must_check-xn_copy.patch --]
[-- Type: text/x-patch; name="must_check-xn_copy.patch", Size: 4787 bytes --]

---
 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

                 reply	other threads:[~2007-11-12 23:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4738DB4D.1020703@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=Xenomai-core@domain.hid \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.