Commit 2f2eaf7b authored by Peter Mitsis's avatar Peter Mitsis Committed by Benjamin Cabé
Browse files

arch: xtensa: Update arch_user_string_nlen()



When calling device_get_binding(NULL) from userspace, this eventually
funnels down to a call to arch_user_string_nlen() where it tried to
verify that the kernel has access to this address (0x0).  But since
this originates from userspace, we really want to know if this is
accessible from userspace, so using arch_buffer_validate() instead
of xtensa_mem_kernel_has_access() is preferable.

Signed-off-by: default avatarPeter Mitsis <peter.mitsis@intel.com>
parent dde94626
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ size_t arch_user_string_nlen(const char *s, size_t maxsize, int *err_arg)
	 * For MPU systems, this would simply results in access errors
	 * and the exception handler will terminate the thread.
	 */
	if (!xtensa_mem_kernel_has_access(s, maxsize, 0)) {
	if (arch_buffer_validate(s, maxsize, 0)) {
		/*
		 * API says we need to set err_arg to -1 if there are
		 * any errors.