diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-15 00:14:53 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:23:01 -0500 |
commit | 9be259aae5264511fe0a8b5e3d6711e0fd1d55df (patch) | |
tree | d424fd156edc0568a1d47b9322b1159202be109b /arch/alpha/lib/csum_partial_copy.c | |
parent | 2bc357987a6510e61d33f3b20fa989fb2b6a10b8 (diff) |
[NET]: Alpha checksum annotations and cleanups.
* sanitize prototypes and annotate
* kill useless access_ok() in csum_partial_copy_from_user() (the only
caller checks it already).
* do_csum_partial_copy_from_user() is not needed now
* replace htons(len) with len << 8 - they are the same wrt checksums
on little-endian.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
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 | } |