FRV: BUG to BUG_ON changes
[sfrench/cifs-2.6.git] / arch / frv / kernel / uaccess.c
index f3fd58a5bc4a84ba2256d39bc5ffff25f66acc22..374f88d6cc00d0c32fffd03f5c7b3a8b1af395ee 100644 (file)
  */
 
 #include <linux/mm.h>
+#include <linux/module.h>
 #include <asm/uaccess.h>
 
 /*****************************************************************************/
 /*
  * copy a null terminated string from userspace
  */
-long strncpy_from_user(char *dst, const char *src, long count)
+long strncpy_from_user(char *dst, const char __user *src, long count)
 {
        unsigned long max;
        char *p, ch;
        long err = -EFAULT;
 
-       if (count < 0)
-               BUG();
+       BUG_ON(count < 0);
 
        p = dst;
 
@@ -58,22 +58,24 @@ long strncpy_from_user(char *dst, const char *src, long count)
                memset(p, 0, count); /* clear remainder of buffer [security] */
 
        return err;
+
 } /* end strncpy_from_user() */
 
+EXPORT_SYMBOL(strncpy_from_user);
+
 /*****************************************************************************/
 /*
  * Return the size of a string (including the ending 0)
  *
  * Return 0 on exception, a value greater than N if too long
  */
-long strnlen_user(const char *src, long count)
+long strnlen_user(const char __user *src, long count)
 {
-       const char *p;
+       const char __user *p;
        long err = 0;
        char ch;
 
-       if (count < 0)
-               BUG();
+       BUG_ON(count < 0);
 
 #ifndef CONFIG_MMU
        if ((unsigned long) src < memory_start)
@@ -92,4 +94,7 @@ long strnlen_user(const char *src, long count)
        }
 
        return p - src + 1; /* return length including NUL */
+
 } /* end strnlen_user() */
+
+EXPORT_SYMBOL(strnlen_user);