lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170217165229.17768-1-stephen.boyd@linaro.org>
Date:   Fri, 17 Feb 2017 08:52:29 -0800
From:   Stephen Boyd <stephen.boyd@...aro.org>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: [PATCH] asm-generic: Force cast get_user() setting x to 0

If we call get_user() with an __le* or __be* type sparse will
complain when we assign the result to 0 on the faulting path.
Let's force cast here so that sparse doesn't complain. This
mirrors what we do in __get_user() as well.

Signed-off-by: Stephen Boyd <stephen.boyd@...aro.org>
---

I made a similar fix to arm64 headers, and it looks like asm-generic
would need the same fix.

 include/asm-generic/uaccess.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index cc6bb319e464..6352d61df7eb 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -227,7 +227,7 @@ extern int __put_user_bad(void) __attribute__((noreturn));
 	might_fault();						\
 	access_ok(VERIFY_READ, __p, sizeof(*ptr)) ?		\
 		__get_user((x), (__typeof__(*(ptr)) *)__p) :	\
-		((x) = (__typeof__(*(ptr)))0,-EFAULT);		\
+		((x) = (__force __typeof__(*(ptr)))0, -EFAULT);	\
 })
 
 #ifndef __get_user_fn
-- 
2.10.0.297.gf6727b0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ