From: Dipendra Khadka <kdipendra88@gmail.com>
To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com
Cc: Dipendra Khadka <kdipendra88@gmail.com>,
mjguzik@gmail.com, ira.weiny@intel.com,
linux-kernel@vger.kernel.org
Subject: [PATCH] x86: Fixes warning: cast removes address space '__user' of expression in uaccess_64.h
Date: Thu, 16 Nov 2023 17:38:48 +0000 [thread overview]
Message-ID: <20231116173849.210205-1-kdipendra88@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2023-11-16 17:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 17:38 Dipendra Khadka [this message]
2023-11-17 15:19 ` Dave Hansen
[not found] ` <CAEKBCKNsw60QM=Ay6CH2Kuh-L8YdjVB5yScjG9pTZUXcBrsf5w@mail.gmail.com>
2023-11-17 19:31 ` Dipendra Khadka
2023-11-17 19:47 ` Dipendra Khadka
2023-12-23 9:07 ` Dipendra Khadka
2024-01-24 6:08 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231116173849.210205-1-kdipendra88@gmail.com \
--to=kdipendra88@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=ira.weiny@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mjguzik@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®