io_uring: ensure finish_wait() is always called in __io_uring_task_cancel()
[linux/fpc-iii.git] / arch / powerpc / lib / checksum_wrappers.c
blobb895166afc8283b8f4dbbc753a17d331f10cff1b
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
4 * Copyright (C) IBM Corporation, 2010
6 * Author: Anton Blanchard <anton@au.ibm.com>
7 */
8 #include <linux/export.h>
9 #include <linux/compiler.h>
10 #include <linux/types.h>
11 #include <asm/checksum.h>
12 #include <linux/uaccess.h>
14 __wsum csum_and_copy_from_user(const void __user *src, void *dst,
15 int len)
17 __wsum csum;
19 might_sleep();
21 if (unlikely(!access_ok(src, len)))
22 return 0;
24 allow_read_from_user(src, len);
26 csum = csum_partial_copy_generic((void __force *)src, dst, len);
28 prevent_read_from_user(src, len);
29 return csum;
31 EXPORT_SYMBOL(csum_and_copy_from_user);
33 __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len)
35 __wsum csum;
37 might_sleep();
38 if (unlikely(!access_ok(dst, len)))
39 return 0;
41 allow_write_to_user(dst, len);
43 csum = csum_partial_copy_generic(src, (void __force *)dst, len);
45 prevent_write_to_user(dst, len);
46 return csum;
48 EXPORT_SYMBOL(csum_and_copy_to_user);