/*1* arch/score/lib/csum_partial_copy.c2*3* Score Processor version.4*5* Copyright (C) 2009 Sunplus Core Technology Co., Ltd.6* Lennox Wu <[email protected]>7* Chen Liqin <[email protected]>8*9* This program is free software; you can redistribute it and/or modify10* it under the terms of the GNU General Public License as published by11* the Free Software Foundation; either version 2 of the License, or12* (at your option) any later version.13*14* This program is distributed in the hope that it will be useful,15* but WITHOUT ANY WARRANTY; without even the implied warranty of16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17* GNU General Public License for more details.18*19* You should have received a copy of the GNU General Public License20* along with this program; if not, see the file COPYING, or write21* to the Free Software Foundation, Inc.,22* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA23*/2425#include <net/checksum.h>2627#include <asm/uaccess.h>2829unsigned int csum_partial_copy(const char *src, char *dst,30int len, unsigned int sum)31{32sum = csum_partial(src, len, sum);33memcpy(dst, src, len);3435return sum;36}3738unsigned int csum_partial_copy_from_user(const char *src, char *dst,39int len, unsigned int sum,40int *err_ptr)41{42int missing;4344missing = copy_from_user(dst, src, len);45if (missing) {46memset(dst + len - missing, 0, missing);47*err_ptr = -EFAULT;48}4950return csum_partial(dst, len, sum);51}525354