linux/arch/powerpc/lib/checksum_wrappers.c
Christoph Hellwig 6308499b5e net: unexport csum_and_copy_{from,to}_user
csum_and_copy_from_user and csum_and_copy_to_user are exported by a few
architectures, but not actually used in modular code.  Drop the exports.

Link: https://lkml.kernel.org/r/20220421070440.1282704-1-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-04-29 14:37:59 -07:00

40 lines
813 B
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
*
* Copyright (C) IBM Corporation, 2010
*
* Author: Anton Blanchard <anton@au.ibm.com>
*/
#include <linux/export.h>
#include <linux/compiler.h>
#include <linux/types.h>
#include <asm/checksum.h>
#include <linux/uaccess.h>
__wsum csum_and_copy_from_user(const void __user *src, void *dst,
int len)
{
__wsum csum;
if (unlikely(!user_read_access_begin(src, len)))
return 0;
csum = csum_partial_copy_generic((void __force *)src, dst, len);
user_read_access_end();
return csum;
}
__wsum csum_and_copy_to_user(const void *src, void __user *dst, int len)
{
__wsum csum;
if (unlikely(!user_write_access_begin(dst, len)))
return 0;
csum = csum_partial_copy_generic(src, (void __force *)dst, len);
user_write_access_end();
return csum;
}