From: Nuno Das Neves <nunodasneves@linux.microsoft.com>
To: mhklinux@outlook.com, kys@microsoft.com, haiyangz@microsoft.com,
wei.liu@kernel.org, decui@microsoft.com, longli@microsoft.com,
linux-hyperv@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] mshv: Add __user attribute to argument passed to access_ok()
Date: Wed, 14 Jan 2026 10:39:14 -0800 [thread overview]
Message-ID: <eb163338-cd03-49c6-8c44-f6fac39ba7f6@linux.microsoft.com> (raw)
In-Reply-To: <20260114181508.143564-1-mhklinux@outlook.com>
On 1/14/2026 10:15 AM, mhkelley58@gmail.com wrote:
> From: Michael Kelley <mhklinux@outlook.com>
>
> access_ok() expects its first argument to have the __user attribute
> since it is checking access to user space. Current code passes an
> argument that lacks that attribute, resulting in 'sparse' flagging
> the incorrect usage. However, the compiler doesn't generate code
> based on the attribute, so there's no actual bug.
>
> In the interest of general correctness and to avoid noise from sparse,
> add the __user attribute. No functional change.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202512141339.791TCKnB-lkp@intel.com/
> Signed-off-by: Michael Kelley <mhklinux@outlook.com>
> ---
> drivers/hv/mshv_root_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c
> index eff1b21461dc..5673af9fe101 100644
> --- a/drivers/hv/mshv_root_main.c
> +++ b/drivers/hv/mshv_root_main.c
> @@ -1280,7 +1280,7 @@ mshv_map_user_memory(struct mshv_partition *partition,
> long ret;
>
> if (mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP) ||
> - !access_ok((const void *)mem.userspace_addr, mem.size))
> + !access_ok((const void __user *)mem.userspace_addr, mem.size))
> return -EINVAL;
>
> mmap_read_lock(current->mm);
Reviewed-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
next prev parent reply other threads:[~2026-01-14 18:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 18:15 [PATCH 1/1] mshv: Add __user attribute to argument passed to access_ok() mhkelley58
2026-01-14 18:39 ` Nuno Das Neves [this message]
2026-01-15 7:12 ` Wei Liu
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=eb163338-cd03-49c6-8c44-f6fac39ba7f6@linux.microsoft.com \
--to=nunodasneves@linux.microsoft.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=mhklinux@outlook.com \
--cc=wei.liu@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