diff options
Diffstat (limited to 'arch/alpha/lib/csum_partial_copy.c')
-rw-r--r-- | arch/alpha/lib/csum_partial_copy.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c index a37948f3037a..4ca75c74ce90 100644 --- a/arch/alpha/lib/csum_partial_copy.c +++ b/arch/alpha/lib/csum_partial_copy.c | |||
@@ -329,11 +329,11 @@ csum_partial_cfu_unaligned(const unsigned long __user * src, | |||
329 | return checksum; | 329 | return checksum; |
330 | } | 330 | } |
331 | 331 | ||
332 | static unsigned int | 332 | __wsum |
333 | do_csum_partial_copy_from_user(const char __user *src, char *dst, int len, | 333 | csum_partial_copy_from_user(const void __user *src, void *dst, int len, |
334 | unsigned int sum, int *errp) | 334 | __wsum sum, int *errp) |
335 | { | 335 | { |
336 | unsigned long checksum = (unsigned) sum; | 336 | unsigned long checksum = (__force u32) sum; |
337 | unsigned long soff = 7 & (unsigned long) src; | 337 | unsigned long soff = 7 & (unsigned long) src; |
338 | unsigned long doff = 7 & (unsigned long) dst; | 338 | unsigned long doff = 7 & (unsigned long) dst; |
339 | 339 | ||
@@ -367,25 +367,12 @@ do_csum_partial_copy_from_user(const char __user *src, char *dst, int len, | |||
367 | } | 367 | } |
368 | checksum = from64to16 (checksum); | 368 | checksum = from64to16 (checksum); |
369 | } | 369 | } |
370 | return checksum; | 370 | return (__force __wsum)checksum; |
371 | } | ||
372 | |||
373 | unsigned int | ||
374 | csum_partial_copy_from_user(const char __user *src, char *dst, int len, | ||
375 | unsigned int sum, int *errp) | ||
376 | { | ||
377 | if (!access_ok(VERIFY_READ, src, len)) { | ||
378 | *errp = -EFAULT; | ||
379 | memset(dst, 0, len); | ||
380 | return sum; | ||
381 | } | ||
382 | |||
383 | return do_csum_partial_copy_from_user(src, dst, len, sum, errp); | ||
384 | } | 371 | } |
385 | 372 | ||
386 | unsigned int | 373 | __wsum |
387 | csum_partial_copy_nocheck(const char __user *src, char *dst, int len, | 374 | csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) |
388 | unsigned int sum) | ||
389 | { | 375 | { |
390 | return do_csum_partial_copy_from_user(src, dst, len, sum, NULL); | 376 | return csum_partial_copy_from_user((__force const void __user *)src, |
377 | dst, len, sum, NULL); | ||
391 | } | 378 | } |