The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: kernel test robot <lkp@intel.com>
Cc: "Clément Léger" <cleger@rivosinc.com>,
	oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Alexandre Ghiti" <alexghiti@rivosinc.com>
Subject: Re: mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces)
Date: Sat, 16 Aug 2025 17:19:28 +0100	[thread overview]
Message-ID: <20250816161928.GU222315@ZenIV> (raw)
In-Reply-To: <202508161713.RWu30Lv1-lkp@intel.com>

On Sat, Aug 16, 2025 at 05:28:29PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   dfd4b508c8c6106083698a0dd5e35aecc7c48725
> commit: ca1a66cdd685030738cf077e3955fdedfe39fbb9 riscv: uaccess: do not do misaligned accesses in get/put_user()
> date:   2 months ago
> config: riscv-randconfig-r122-20250816 (https://download.01.org/0day-ci/archive/20250816/202508161713.RWu30Lv1-lkp@intel.com/config)
> compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 93d24b6b7b148c47a2fa228a4ef31524fa1d9f3f)
> reproduce: (https://download.01.org/0day-ci/archive/20250816/202508161713.RWu30Lv1-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202508161713.RWu30Lv1-lkp@intel.com/
> 
> sparse warnings: (new ones prefixed by >>)
>    WARNING: invalid argument to '-march': '_zacas_zabha'
> >> mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned long long [usertype] * @@
>    mm/maccess.c:41:17: sparse:     expected void const [noderef] __user *from
>    mm/maccess.c:41:17: sparse:     got unsigned long long [usertype] *
> >> mm/maccess.c:43:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned int [usertype] * @@
>    mm/maccess.c:43:17: sparse:     expected void const [noderef] __user *from
>    mm/maccess.c:43:17: sparse:     got unsigned int [usertype] *
> >> mm/maccess.c:45:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned short [usertype] * @@
>    mm/maccess.c:45:17: sparse:     expected void const [noderef] __user *from
>    mm/maccess.c:45:17: sparse:     got unsigned short [usertype] *
> >> mm/maccess.c:46:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned char [usertype] * @@
>    mm/maccess.c:46:9: sparse:     expected void const [noderef] __user *from
>    mm/maccess.c:46:9: sparse:     got unsigned char [usertype] *
> >> mm/maccess.c:73:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned long long [usertype] * @@
>    mm/maccess.c:73:17: sparse:     expected void [noderef] __user *to
>    mm/maccess.c:73:17: sparse:     got unsigned long long [usertype] *
> >> mm/maccess.c:75:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned int [usertype] * @@
>    mm/maccess.c:75:17: sparse:     expected void [noderef] __user *to
>    mm/maccess.c:75:17: sparse:     got unsigned int [usertype] *
> >> mm/maccess.c:77:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned short [usertype] * @@
>    mm/maccess.c:77:17: sparse:     expected void [noderef] __user *to
>    mm/maccess.c:77:17: sparse:     got unsigned short [usertype] *
> >> mm/maccess.c:78:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned char [usertype] * @@
>    mm/maccess.c:78:9: sparse:     expected void [noderef] __user *to
>    mm/maccess.c:78:9: sparse:     got unsigned char [usertype] *
>    mm/maccess.c:98:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned char [usertype] * @@
>    mm/maccess.c:98:17: sparse:     expected void const [noderef] __user *from
>    mm/maccess.c:98:17: sparse:     got unsigned char [usertype] *

... and that clearly has fuck-all to do with mm/maccess.c.
The problem is in
#define __get_kernel_nofault(dst, src, type, err_label)                 \
        __get_user_nocheck(*((type *)(dst)), (type *)(src), err_label)

Make that
        __get_user_nocheck(*((type *)(dst)), (__force __user type *)(src), err_label)
and similar in
#define __put_kernel_nofault(dst, src, type, err_label)                 \
        __put_user_nocheck(*((type *)(src)), (type *)(dst), err_label)
(cast also on the second argument) and see how much noise will go away.

  reply	other threads:[~2025-08-16 16:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-16  9:28 mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces) kernel test robot
2025-08-16 16:19 ` Al Viro [this message]
2025-08-16 16:54   ` Palmer Dabbelt
  -- strict thread matches above, loose matches on Subject: below --
2025-07-14 12:48 kernel test robot
2025-06-07 11:43 kernel test robot

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=20250816161928.GU222315@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=alexghiti@rivosinc.com \
    --cc=cleger@rivosinc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=palmer@dabbelt.com \
    /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