From 9e4d84273c9d786ee7592970f0a46c1c28eb3c18 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Wed, 3 Feb 2021 17:16:09 -0800 Subject: [PATCH] ANDROID: Fix sparse warning in __handle_speculative_fault caused by SPF SPF patchset introduced a sparse warning caused by the mismatch in __handle_speculative_fault function's return type. Fix the return type. Fixes: 1c5371744061 ("FROMLIST: mm: provide speculative fault infrastructure") Bug: 161210518 Signed-off-by: Suren Baghdasaryan Change-Id: I27c75f2b3729fa5d4b610f4a1829c9beba29735c --- include/linux/mm.h | 24 ++++++++++++------------ mm/memory.c | 8 +++++--- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1581b7bc25e7..836deddfa733 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1749,14 +1749,14 @@ extern int fixup_user_fault(struct mm_struct *mm, bool *unlocked); #ifdef CONFIG_SPECULATIVE_PAGE_FAULT -extern int __handle_speculative_fault(struct mm_struct *mm, - unsigned long address, - unsigned int flags, - struct vm_area_struct **vma); -static inline int handle_speculative_fault(struct mm_struct *mm, - unsigned long address, - unsigned int flags, - struct vm_area_struct **vma) +extern vm_fault_t __handle_speculative_fault(struct mm_struct *mm, + unsigned long address, + unsigned int flags, + struct vm_area_struct **vma); +static inline vm_fault_t handle_speculative_fault(struct mm_struct *mm, + unsigned long address, + unsigned int flags, + struct vm_area_struct **vma) { /* * Try speculative page fault for multithreaded user space task only. @@ -1770,10 +1770,10 @@ static inline int handle_speculative_fault(struct mm_struct *mm, extern bool can_reuse_spf_vma(struct vm_area_struct *vma, unsigned long address); #else -static inline int handle_speculative_fault(struct mm_struct *mm, - unsigned long address, - unsigned int flags, - struct vm_area_struct **vma) +static inline vm_fault_t handle_speculative_fault(struct mm_struct *mm, + unsigned long address, + unsigned int flags, + struct vm_area_struct **vma) { return VM_FAULT_RETRY; } diff --git a/mm/memory.c b/mm/memory.c index 1d46609c4597..6145a2b10d51 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4841,8 +4841,9 @@ static inline void mm_account_fault(struct pt_regs *regs, * This is needed as the returned vma is kept in memory until the call to * can_reuse_spf_vma() is made. */ -int __handle_speculative_fault(struct mm_struct *mm, unsigned long address, - unsigned int flags, struct vm_area_struct **vma) +vm_fault_t __handle_speculative_fault(struct mm_struct *mm, + unsigned long address, unsigned int flags, + struct vm_area_struct **vma) { struct vm_fault vmf = { .address = address, @@ -4850,7 +4851,8 @@ int __handle_speculative_fault(struct mm_struct *mm, unsigned long address, pgd_t *pgd, pgdval; p4d_t *p4d, p4dval; pud_t pudval; - int seq, ret; + int seq; + vm_fault_t ret; /* Clear flags that may lead to release the mmap_sem to retry */ flags &= ~(FAULT_FLAG_ALLOW_RETRY|FAULT_FLAG_KILLABLE);