linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Souptick Joarder <jrdr.linux@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: kbuild test robot <lkp@intel.com>,
	kbuild-all@01.org, linux-kernel@vger.kernel.org,
	 William Kucharski <william.kucharski@oracle.com>,
	Mike Rapoport <rppt@linux.ibm.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	 Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: mm/memory.c:3968:21: sparse: incorrect type in assignment (different base types)
Date: Sat, 16 Mar 2019 00:35:37 +0530	[thread overview]
Message-ID: <CAFqt6za4x8DCoRdyFDcmR8A+CczebqNRKDKhvkz06JRN5_Hnrg@mail.gmail.com> (raw)
In-Reply-To: <20190314160052.GM19508@bombadil.infradead.org>

Hi Matthew,

On Thu, Mar 14, 2019 at 9:30 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Thu, Mar 14, 2019 at 03:10:19PM +0530, Souptick Joarder wrote:
> > > >> mm/memory.c:3968:21: sparse: incorrect type in assignment (different base types) @@    expected restricted vm_fault_t [usertype] ret @@    got e] ret @@
> > >    mm/memory.c:3968:21:    expected restricted vm_fault_t [usertype] ret
> > >    mm/memory.c:3968:21:    got int
> >
> > Looking into https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > hugetlb_fault() is converted to return vm_fault_t. Not sure, why sparse is
> > still throwing warnings.
>
> Because there are two definitions of hugetlb_fault():
>
> $ git grep -wn hugetlb_fault
> include/linux/hugetlb.h:108:vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
> include/linux/hugetlb.h:206:#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; })

make ARCH=x86_64 allmodconfig will set CONFIG_HUGETLB_PAGE =y
which means it shouldn't use the hugetlb_fault() macro in this case.
With *make ARCH=x86_64 allmodconfig* I am unable to reproduce the issue.

But consider the warnings, does the below change is fine ?

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 087fd5f4..0ee502a 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -203,7 +203,6 @@ static inline void hugetlb_show_meminfo(void)
 #define pud_huge(x)    0
 #define is_hugepage_only_range(mm, addr, len)  0
 #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
-#define hugetlb_fault(mm, vma, addr, flags)    ({ BUG(); 0; })
 #define hugetlb_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \
                                src_addr, pagep)        ({ BUG(); 0; })
 #define huge_pte_offset(mm, address, sz)       0
@@ -234,6 +233,13 @@ static inline void __unmap_hugepage_range(struct
mmu_gather *tlb,
 {
        BUG();
 }
+static inline vm_fault_t hugetlb_fault(struct mm_struct *mm,
+                               struct vm_area_struct *vma, unsigned
long address,
+                               unsigned int flags)
+{
+       BUG();
+       return 0;
+}

 #endif /* !CONFIG_HUGETLB_PAGE */


      reply	other threads:[~2019-03-15 19:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 19:15 kbuild test robot
2019-03-14  9:40 ` Souptick Joarder
2019-03-14 16:00   ` Matthew Wilcox
2019-03-15 19:05     ` Souptick Joarder [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=CAFqt6za4x8DCoRdyFDcmR8A+CczebqNRKDKhvkz06JRN5_Hnrg@mail.gmail.com \
    --to=jrdr.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=rppt@linux.ibm.com \
    --cc=william.kucharski@oracle.com \
    --cc=willy@infradead.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