All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: kbuild test robot <lkp@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: kbuild-all@lists.01.org, Johannes Weiner <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [hnaz-linux-mm:master 90/340] arch/x86/mm/fault.c:1468:34: sparse: sparse: incorrect type in argument 1 (different base types)
Date: Wed, 11 Mar 2020 10:59:21 -0400	[thread overview]
Message-ID: <20200311145921.GD479302@xz-x1> (raw)
In-Reply-To: <202003111238.LoxsD1le%lkp@intel.com>

On Wed, Mar 11, 2020 at 12:30:41PM +0800, kbuild test robot wrote:
> tree:   https://github.com/hnaz/linux-mm master
> head:   5d9ee416b5701096536c7a63c04dbe25012baa9e
> commit: 79181dfcc4b8c2091126a8b3175957a598ae61e1 [90/340] x86/mm: use helper fault_signal_pending()
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.1-174-g094d5a94-dirty
>         git checkout 79181dfcc4b8c2091126a8b3175957a598ae61e1
>         make ARCH=x86_64 allmodconfig
>         make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> 
> sparse warnings: (new ones prefixed by >>)
> 
> >> arch/x86/mm/fault.c:1468:34: sparse: sparse: incorrect type in argument 1 (different base types) @@    expected unsigned int fault_flags @@    got restricted vm_fault_t [assignedunsigned int fault_flags @@
> >> arch/x86/mm/fault.c:1468:34: sparse:    expected unsigned int fault_flags
> >> arch/x86/mm/fault.c:1468:34: sparse:    got restricted vm_fault_t [assigned] [usertype] fault
> >> include/linux/sched/signal.h:381:16: sparse: sparse: restricted vm_fault_t degrades to integer

Hi, Andrew,

I'm not sure whether this comes from the extra "-fdiagnostic-prefix"
because I didn't encounter that, but if after the previous signal.h
fixup squashed into patch "mm: Introduce fault_signal_pending()", then
we have linux/mm_types.h included already, and it'll be pretty safe to
just use vm_fault_t here.

To be explicit, maybe another squash-in would work to the same patch:

-------------8<-------------
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index c8e0e4f801e4..65ea429daaa2 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -377,7 +377,7 @@ static inline int signal_pending_state(long state, struct task_struct *p)
  * instead, especially with the case where we've got interrupted with
  * a VM_FAULT_RETRY.
  */
-static inline bool fault_signal_pending(unsigned int fault_flags,
+static inline bool fault_signal_pending(vm_fault_t fault_flags,
                                        struct pt_regs *regs)
 {
        return unlikely((fault_flags & VM_FAULT_RETRY) &&
------------->8-------------

So the whole fixup is (against "mm: Introduce fault_signal_pending()"):

-------------8<-------------
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index fd64b135fd7b..4a0eafe3d932 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -154,7 +154,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,
         */
        fault = handle_mm_fault(vma, address, flags);

-       if (fault_signal_pending(regs))
+       if (fault_signal_pending(fault, regs))
                return;

        perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 09d40ce6a162..65ea429daaa2 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -10,6 +10,8 @@
 #include <linux/cred.h>
 #include <linux/refcount.h>
 #include <linux/posix-timers.h>
+#include <linux/mm_types.h>
+#include <asm/ptrace.h>

 /*
  * Types defining task->signal and task->sighand and APIs using them:
@@ -375,7 +377,7 @@ static inline int signal_pending_state(long state, struct task_struct *p)
  * instead, especially with the case where we've got interrupted with
  * a VM_FAULT_RETRY.
  */
-static inline bool fault_signal_pending(unsigned int fault_flags,
+static inline bool fault_signal_pending(vm_fault_t fault_flags,
                                        struct pt_regs *regs)
 {
        return unlikely((fault_flags & VM_FAULT_RETRY) &&
------------->8-------------

Thanks,

-- 
Peter Xu



      reply	other threads:[~2020-03-11 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  4:30 kbuild test robot
2020-03-11 14:59 ` Peter Xu [this message]

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=20200311145921.GD479302@xz-x1 \
    --to=peterx@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --subject='Re: [hnaz-linux-mm:master 90/340] arch/x86/mm/fault.c:1468:34: sparse: sparse: incorrect type in argument 1 (different base types)' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.