powerpc/book3s64/hash: Add cond_resched to avoid soft lockup warning
[linux-2.6-block.git] / lib / strncpy_from_user.c
index 58eacd41526c58339a7cb35ef92a618f0f3517e4..dccb95af600322cc6a3f7db1229d52b47a6b037b 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
+#include <linux/mm.h>
 
 #include <asm/byteorder.h>
 #include <asm/word-at-a-time.h>
  * hit it), 'max' is the address space maximum (and we return
  * -EFAULT if we hit it).
  */
-static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max)
+static inline long do_strncpy_from_user(char *dst, const char __user *src,
+                                       unsigned long count, unsigned long max)
 {
        const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
-       long res = 0;
+       unsigned long res = 0;
 
        /*
         * Truncate 'max' to the user-specified limit, so that
@@ -107,7 +109,7 @@ long strncpy_from_user(char *dst, const char __user *src, long count)
                return 0;
 
        max_addr = user_addr_max();
-       src_addr = (unsigned long)src;
+       src_addr = (unsigned long)untagged_addr(src);
        if (likely(src_addr < max_addr)) {
                unsigned long max = max_addr - src_addr;
                long retval;