hexagon: fix strncpy_from_user() error return
[pandora-kernel.git] / arch / hexagon / include / asm / uaccess.h
index 7e706ea..c73897c 100644 (file)
@@ -102,7 +102,8 @@ static inline long hexagon_strncpy_from_user(char *dst, const char __user *src,
 {
        long res = __strnlen_user(src, n);
 
-       /* return from strnlen can't be zero -- that would be rubbish. */
+       if (unlikely(!res))
+               return -EFAULT;
 
        if (res > n) {
                copy_from_user(dst, src, n);