18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#include <linux/uaccess.h>
48c2ecf20Sopenharmony_ci#include <linux/kernel.h>
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_cibool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
78c2ecf20Sopenharmony_ci{
88c2ecf20Sopenharmony_ci	/* highest bit set means kernel space */
98c2ecf20Sopenharmony_ci	return (unsigned long)unsafe_src >> (BITS_PER_LONG - 1);
108c2ecf20Sopenharmony_ci}
11