2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1994, 1995 Waldorf Electronics GmbH
7 * Copyright (C) 1998, 1999 Ralf Baechle
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/types.h>
12 #include <asm/byteorder.h>
13 #include <asm/string.h>
14 #include <asm/uaccess.h>
15 #include <net/checksum.h>
18 * copy while checksumming, otherwise like csum_partial
20 __wsum csum_partial_copy_nocheck(const void *src,
21 void *dst, int len, __wsum sum)
24 * It's 2:30 am and I don't feel like doing it real ...
25 * This is lots slower than the real thing (tm)
27 sum = csum_partial(src, len, sum);
28 memcpy(dst, src, len);
33 EXPORT_SYMBOL(csum_partial_copy_nocheck);
36 * Copy from userspace and compute checksum. If we catch an exception
37 * then zero the rest of the buffer.
39 __wsum csum_partial_copy_from_user (const void __user *src,
40 void *dst, int len, __wsum sum, int *err_ptr)
45 missing = copy_from_user(dst, src, len);
47 memset(dst + len - missing, 0, missing);
51 return csum_partial(dst, len, sum);