| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Optimized memory copy routines. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2004 Randolph Chung <tausq@debian.org> |
|---|
| 5 | 6 | * Copyright (C) 2013-2017 Helge Deller <deller@gmx.de> |
|---|
| 6 | 7 | * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - * the Free Software Foundation; either version 2, or (at your option) |
|---|
| 10 | | - * any later version. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License |
|---|
| 18 | | - * along with this program; if not, write to the Free Software |
|---|
| 19 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 20 | | - * |
|---|
| 21 | 8 | * Portions derived from the GNU C Library |
|---|
| 22 | 9 | * Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc. |
|---|
| 23 | | - * |
|---|
| 24 | 10 | */ |
|---|
| 25 | 11 | |
|---|
| 26 | 12 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 71 | 57 | EXPORT_SYMBOL(raw_copy_in_user); |
|---|
| 72 | 58 | EXPORT_SYMBOL(memcpy); |
|---|
| 73 | 59 | |
|---|
| 74 | | -long probe_kernel_read(void *dst, const void *src, size_t size) |
|---|
| 60 | +bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size) |
|---|
| 75 | 61 | { |
|---|
| 76 | | - unsigned long addr = (unsigned long)src; |
|---|
| 77 | | - |
|---|
| 78 | | - if (addr < PAGE_SIZE) |
|---|
| 79 | | - return -EFAULT; |
|---|
| 80 | | - |
|---|
| 62 | + if ((unsigned long)unsafe_src < PAGE_SIZE) |
|---|
| 63 | + return false; |
|---|
| 81 | 64 | /* check for I/O space F_EXTEND(0xfff00000) access as well? */ |
|---|
| 82 | | - |
|---|
| 83 | | - return __probe_kernel_read(dst, src, size); |
|---|
| 65 | + return true; |
|---|
| 84 | 66 | } |
|---|