Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

char: mspec: change return type to vm_fault_t

Use new return type vm_fault_t for the fault handler
in struct vm_operations_struct. 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.

This driver failed to handle any error returned by
vm_insert_pfn. Use the new vmf_insert_pfn function
to return the correct value.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Souptick Joarder and committed by
Greg Kroah-Hartman
3eb87d4e 851b4c14

+2 -9
+2 -9
drivers/char/mspec.c
··· 191 191 * 192 192 * Creates a mspec page and maps it to user space. 193 193 */ 194 - static int 194 + static vm_fault_t 195 195 mspec_fault(struct vm_fault *vmf) 196 196 { 197 197 unsigned long paddr, maddr; ··· 223 223 224 224 pfn = paddr >> PAGE_SHIFT; 225 225 226 - /* 227 - * vm_insert_pfn can fail with -EBUSY, but in that case it will 228 - * be because another thread has installed the pte first, so it 229 - * is no problem. 230 - */ 231 - vm_insert_pfn(vmf->vma, vmf->address, pfn); 232 - 233 - return VM_FAULT_NOPAGE; 226 + return vmf_insert_pfn(vmf->vma, vmf->address, pfn); 234 227 } 235 228 236 229 static const struct vm_operations_struct mspec_vm_ops = {