compat: provide compat_ptr() on all architectures
[sfrench/cifs-2.6.git] / include / linux / compat.h
index 68f79d855c3d2cdf163e48cef0f23dd258e1ad1d..11083d84eb23ead8fcc62ca6277b9c904fe9bb6f 100644 (file)
@@ -958,4 +958,22 @@ static inline bool in_compat_syscall(void) { return false; }
 
 #endif /* CONFIG_COMPAT */
 
+/*
+ * A pointer passed in from user mode. This should not
+ * be used for syscall parameters, just declare them
+ * as pointers because the syscall entry code will have
+ * appropriately converted them already.
+ */
+#ifndef compat_ptr
+static inline void __user *compat_ptr(compat_uptr_t uptr)
+{
+       return (void __user *)(unsigned long)uptr;
+}
+#endif
+
+static inline compat_uptr_t ptr_to_compat(void __user *uptr)
+{
+       return (u32)(unsigned long)uptr;
+}
+
 #endif /* _LINUX_COMPAT_H */