Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Heiko Carstens and committed by
Martin Schwidefsky
d72d2bb5 82300202

+2 -9
+2 -9
arch/s390/include/asm/checksum.h
··· 44 44 * here even more important to align src and dst on a 32-bit (or even 45 45 * better 64-bit) boundary 46 46 * 47 - * Copy from userspace and compute checksum. If we catch an exception 48 - * then zero the rest of the buffer. 47 + * Copy from userspace and compute checksum. 49 48 */ 50 49 static inline __wsum 51 50 csum_partial_copy_from_user(const void __user *src, void *dst, 52 51 int len, __wsum sum, 53 52 int *err_ptr) 54 53 { 55 - int missing; 56 - 57 - missing = copy_from_user(dst, src, len); 58 - if (missing) { 59 - memset(dst + len - missing, 0, missing); 54 + if (unlikely(copy_from_user(dst, src, len))) 60 55 *err_ptr = -EFAULT; 61 - } 62 - 63 56 return csum_partial(dst, len, sum); 64 57 } 65 58