diff options
Diffstat (limited to 'lib/strncpy_from_user.c')
-rw-r--r-- | lib/strncpy_from_user.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index 33f655ef48cd..9c5fe8110413 100644 --- a/lib/strncpy_from_user.c +++ b/lib/strncpy_from_user.c | |||
@@ -40,8 +40,8 @@ static inline long do_strncpy_from_user(char *dst, const char __user *src, long | |||
40 | unsigned long c, data; | 40 | unsigned long c, data; |
41 | 41 | ||
42 | /* Fall back to byte-at-a-time if we get a page fault */ | 42 | /* Fall back to byte-at-a-time if we get a page fault */ |
43 | if (unlikely(unsafe_get_user(c,(unsigned long __user *)(src+res)))) | 43 | unsafe_get_user(c, (unsigned long __user *)(src+res), byte_at_a_time); |
44 | break; | 44 | |
45 | *(unsigned long *)(dst+res) = c; | 45 | *(unsigned long *)(dst+res) = c; |
46 | if (has_zero(c, &data, &constants)) { | 46 | if (has_zero(c, &data, &constants)) { |
47 | data = prep_zero_mask(c, data, &constants); | 47 | data = prep_zero_mask(c, data, &constants); |
@@ -56,8 +56,7 @@ byte_at_a_time: | |||
56 | while (max) { | 56 | while (max) { |
57 | char c; | 57 | char c; |
58 | 58 | ||
59 | if (unlikely(unsafe_get_user(c,src+res))) | 59 | unsafe_get_user(c,src+res, efault); |
60 | return -EFAULT; | ||
61 | dst[res] = c; | 60 | dst[res] = c; |
62 | if (!c) | 61 | if (!c) |
63 | return res; | 62 | return res; |
@@ -76,6 +75,7 @@ byte_at_a_time: | |||
76 | * Nope: we hit the address space limit, and we still had more | 75 | * Nope: we hit the address space limit, and we still had more |
77 | * characters the caller would have wanted. That's an EFAULT. | 76 | * characters the caller would have wanted. That's an EFAULT. |
78 | */ | 77 | */ |
78 | efault: | ||
79 | return -EFAULT; | 79 | return -EFAULT; |
80 | } | 80 | } |
81 | 81 | ||