aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2014-02-24 10:33:08 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-02-24 11:14:08 -0500
commitd72d2bb5a6bc85af77a9f969687c74ea00cdcc99 (patch)
tree68292ca2d8ad311d11c7bb943f46244e6d9e9560
parent823002023da6d9124ed63bc622267c15ab2a7347 (diff)
s390/checksum: remove memset() within csum_partial_copy_from_user()
The memset() within csum_partial_copy_from_user() is rather pointless since copy_from_user() already cleared the rest of the destination buffer if an exception happened. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/checksum.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/arch/s390/include/asm/checksum.h b/arch/s390/include/asm/checksum.h
index 4f57a4f3909a..740364856355 100644
--- a/arch/s390/include/asm/checksum.h
+++ b/arch/s390/include/asm/checksum.h
@@ -44,22 +44,15 @@ csum_partial(const void *buff, int len, __wsum sum)
44 * here even more important to align src and dst on a 32-bit (or even 44 * here even more important to align src and dst on a 32-bit (or even
45 * better 64-bit) boundary 45 * better 64-bit) boundary
46 * 46 *
47 * Copy from userspace and compute checksum. If we catch an exception 47 * Copy from userspace and compute checksum.
48 * then zero the rest of the buffer.
49 */ 48 */
50static inline __wsum 49static inline __wsum
51csum_partial_copy_from_user(const void __user *src, void *dst, 50csum_partial_copy_from_user(const void __user *src, void *dst,
52 int len, __wsum sum, 51 int len, __wsum sum,
53 int *err_ptr) 52 int *err_ptr)
54{ 53{
55 int missing; 54 if (unlikely(copy_from_user(dst, src, len)))
56
57 missing = copy_from_user(dst, src, len);
58 if (missing) {
59 memset(dst + len - missing, 0, missing);
60 *err_ptr = -EFAULT; 55 *err_ptr = -EFAULT;
61 }
62
63 return csum_partial(dst, len, sum); 56 return csum_partial(dst, len, sum);
64} 57}
65 58