Re: [PATCH] mm: Change return type to vm_fault_t

From: Matthew Wilcox
Date: Tue May 29 2018 - 10:52:21 EST


On Tue, May 29, 2018 at 08:01:26PM +0530, Souptick Joarder wrote:
> Use new return type vm_fault_t for fault handler. For
> now, this is just documenting that the function returns
> a VM_FAULT value rather than an errno. Once all instances
> are converted, vm_fault_t will become a distinct type.

I don't believe you've checked this with sparse.

> @@ -802,7 +802,8 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,
> bool *unlocked)
> {
> struct vm_area_struct *vma;
> - int ret, major = 0;
> + int major = 0;
> + vm_fault_t ret;
>
> if (unlocked)
> fault_flags |= FAULT_FLAG_ALLOW_RETRY;

...
major |= ret & VM_FAULT_MAJOR;

That should be throwing a warning.