From: Dave Hansen <dave.hansen@intel.com>
To: Dipendra Khadka <kdipendra88@gmail.com>,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com
Cc: mjguzik@gmail.com, ira.weiny@intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Fixes warning: cast removes address space '__user' of expression in uaccess_64.h
Date: Fri, 17 Nov 2023 07:19:12 -0800 [thread overview]
Message-ID: <3ff3e05a-8377-4b38-84ae-be24b6cae6a4@intel.com> (raw)
In-Reply-To: <20231116173849.210205-1-kdipendra88@gmail.com>
On 11/16/23 09:38, Dipendra Khadka wrote:
> 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.
Why does sparse complain about a cast to 'long' but not 'unsigned long'?
Both remove the '__user' address space from the expression. Were there
just so many __user pointers being cast to 'unsigned long' that there's
an exception in sparse for 'void __user *' => 'unsigned long'?
Either way, if we're going to fix it it seems like it would be better to
valid_user_address() actually handle, well, __user addresses rather than
expecting callers to do it.
next prev parent reply other threads:[~2023-11-17 15:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 17:38 Dipendra Khadka
2023-11-17 15:19 ` Dave Hansen [this message]
[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=3ff3e05a-8377-4b38-84ae-be24b6cae6a4@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=ira.weiny@intel.com \
--cc=kdipendra88@gmail.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®