Fix: mm: create the new vm_fault_t type (v5.1)
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 18 Mar 2019 20:20:32 +0000 (16:20 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 18 Mar 2019 20:37:19 +0000 (16:37 -0400)
See upstream commit:

  commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
  Author: Souptick Joarder <jrdr.linux@gmail.com>
  Date:   Thu Mar 7 16:31:14 2019 -0800

    mm: create the new vm_fault_t type

    Page fault handlers are supposed to return VM_FAULT codes, but some
    drivers/file systems mistakenly return error numbers.  Now that all
    drivers/file systems have been converted to use the vm_fault_t return
    type, change the type definition to no longer be compatible with 'int'.
    By making it an unsigned int, the function prototype becomes
    incompatible with a function which returns int.  Sparse will detect any
    attempts to return a value which is not a VM_FAULT code.

    VM_FAULT_SET_HINDEX and VM_FAULT_GET_HINDEX values are changed to avoid
    conflict with other VM_FAULT codes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/ringbuffer/ring_buffer_mmap.c

index 30dd93ef6375ec5979fb9b45e3d00eb64a01c41e..fab945887855c0eb20967721b3cdc0b3f5dd21fb 100644 (file)
 /*
  * fault() vm_op implementation for ring buffer file mapping.
  */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
+static vm_fault_t lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fault *vmf)
+#else
 static int lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fault *vmf)
+#endif
 {
        struct lib_ring_buffer *buf = vma->vm_private_data;
        struct channel *chan = buf->backend.chan;
@@ -53,7 +57,13 @@ static int lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fa
        return 0;
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0))
+static vm_fault_t lib_ring_buffer_fault(struct vm_fault *vmf)
+{
+       struct vm_area_struct *vma = vmf->vma;
+       return lib_ring_buffer_fault_compat(vma, vmf);
+}
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
 static int lib_ring_buffer_fault(struct vm_fault *vmf)
 {
        struct vm_area_struct *vma = vmf->vma;
This page took 0.026141 seconds and 4 git commands to generate.