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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231116173849.210205-1-kdipendra88@gmail.com>
Date:   Thu, 16 Nov 2023 17:38:48 +0000
From:   Dipendra Khadka <kdipendra88@...il.com>
To:     tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com
Cc:     Dipendra Khadka <kdipendra88@...il.com>, mjguzik@...il.com,
        ira.weiny@...el.com, linux-kernel@...r.kernel.org
Subject: [PATCH] x86: Fixes warning: cast removes address space '__user' of expression in uaccess_64.h

Sparse has identified a warning as follows:

./arch/x86/include/asm/uaccess_64.h:88:24: warning: cast removes address space '__user' of expression.

Since the valid_user_address(x) macro implicitly casts the argument
to long and compares the converted value of x to zero, casting ptr
to unsigned long has no functional impact and does not trigger a 
Sparse warning either.

Signed-off-by: Dipendra Khadka <kdipendra88@...il.com>
---
 arch/x86/include/asm/uaccess_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index f2c02e4469cc..da24d807e101 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -85,7 +85,7 @@ static inline unsigned long __untagged_addr_remote(struct mm_struct *mm,
 static inline bool __access_ok(const void __user *ptr, unsigned long size)
 {
 	if (__builtin_constant_p(size <= PAGE_SIZE) && size <= PAGE_SIZE) {
-		return valid_user_address(ptr);
+		return valid_user_address((unsigned long)ptr);
 	} else {
 		unsigned long sum = size + (unsigned long)ptr;
 		return valid_user_address(sum) && sum >= (unsigned long)ptr;
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ