mm: use vmf->address instead of of vmf->virtual_address
authorJan Kara <jack@suse.cz>
Wed, 14 Dec 2016 23:07:01 +0000 (15:07 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 15 Dec 2016 00:04:09 +0000 (16:04 -0800)
Every single user of vmf->virtual_address typed that entry to unsigned
long before doing anything with it so the type of virtual_address does
not really provide us any additional safety.  Just use masked
vmf->address which already has the appropriate type.

Link: http://lkml.kernel.org/r/1479460644-25076-3-git-send-email-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27 files changed:
arch/powerpc/platforms/cell/spufs/file.c
arch/x86/entry/vdso/vma.c
drivers/char/agp/alpha-agp.c
drivers/char/mspec.c
drivers/dax/dax.c
drivers/gpu/drm/armada/armada_gem.c
drivers/gpu/drm/drm_vm.c
drivers/gpu/drm/etnaviv/etnaviv_gem.c
drivers/gpu/drm/exynos/exynos_drm_gem.c
drivers/gpu/drm/gma500/framebuffer.c
drivers/gpu/drm/gma500/gem.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/msm/msm_gem.c
drivers/gpu/drm/omapdrm/omap_gem.c
drivers/gpu/drm/tegra/gem.c
drivers/gpu/drm/ttm/ttm_bo_vm.c
drivers/gpu/drm/udl/udl_gem.c
drivers/gpu/drm/vgem/vgem_drv.c
drivers/media/v4l2-core/videobuf-dma-sg.c
drivers/misc/cxl/context.c
drivers/misc/sgi-gru/grumain.c
drivers/staging/android/ion/ion.c
drivers/staging/lustre/lustre/llite/vvp_io.c
drivers/xen/privcmd.c
fs/dax.c
include/linux/mm.h
mm/memory.c

index 06254467e4dd9c57b804dd43d8dd4353feea8e3c..3a147122bc9890045ac57e6d649a11bebec7d0ba 100644 (file)
@@ -236,7 +236,6 @@ static int
 spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct spu_context *ctx = vma->vm_file->private_data;
-       unsigned long address = (unsigned long)vmf->virtual_address;
        unsigned long pfn, offset;
 
        offset = vmf->pgoff << PAGE_SHIFT;
@@ -244,7 +243,7 @@ spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
                return VM_FAULT_SIGBUS;
 
        pr_debug("spufs_mem_mmap_fault address=0x%lx, offset=0x%lx\n",
-                       address, offset);
+                       vmf->address, offset);
 
        if (spu_acquire(ctx))
                return VM_FAULT_NOPAGE;
@@ -256,7 +255,7 @@ spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
                vma->vm_page_prot = pgprot_noncached_wc(vma->vm_page_prot);
                pfn = (ctx->spu->local_store_phys + offset) >> PAGE_SHIFT;
        }
-       vm_insert_pfn(vma, address, pfn);
+       vm_insert_pfn(vma, vmf->address, pfn);
 
        spu_release(ctx);
 
@@ -355,8 +354,7 @@ static int spufs_ps_fault(struct vm_area_struct *vma,
                down_read(&current->mm->mmap_sem);
        } else {
                area = ctx->spu->problem_phys + ps_offs;
-               vm_insert_pfn(vma, (unsigned long)vmf->virtual_address,
-                                       (area + offset) >> PAGE_SHIFT);
+               vm_insert_pfn(vma, vmf->address, (area + offset) >> PAGE_SHIFT);
                spu_context_trace(spufs_ps_fault__insert, ctx, ctx->spu);
        }
 
index e739002427ed12fcbd4924d22938676643b6478e..40121d14d34d140b5dcd8b14ed0143d9f6b70a02 100644 (file)
@@ -109,7 +109,7 @@ static int vvar_fault(const struct vm_special_mapping *sm,
                return VM_FAULT_SIGBUS;
 
        if (sym_offset == image->sym_vvar_page) {
-               ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address,
+               ret = vm_insert_pfn(vma, vmf->address,
                                    __pa_symbol(&__vvar_page) >> PAGE_SHIFT);
        } else if (sym_offset == image->sym_pvclock_page) {
                struct pvclock_vsyscall_time_info *pvti =
@@ -117,7 +117,7 @@ static int vvar_fault(const struct vm_special_mapping *sm,
                if (pvti && vclock_was_used(VCLOCK_PVCLOCK)) {
                        ret = vm_insert_pfn(
                                vma,
-                               (unsigned long)vmf->virtual_address,
+                               vmf->address,
                                __pa(pvti) >> PAGE_SHIFT);
                }
        }
index 199b8e99f7d7886d5d5e59b4fff5bf43337e523d..737187865269e9470ae6ef59556727144afb54d4 100644 (file)
@@ -19,8 +19,7 @@ static int alpha_core_agp_vm_fault(struct vm_area_struct *vma,
        unsigned long pa;
        struct page *page;
 
-       dma_addr = (unsigned long)vmf->virtual_address - vma->vm_start
-                                               + agp->aperture.bus_base;
+       dma_addr = vmf->address - vma->vm_start + agp->aperture.bus_base;
        pa = agp->ops->translate(agp, dma_addr);
 
        if (pa == (unsigned long)-EINVAL)
index f3f92d5fcda05b2a3692d9f100c7caa48445e5e1..a697ca0cab1e1e2ff56fcf86c41793aad507c524 100644 (file)
@@ -227,7 +227,7 @@ mspec_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
         * be because another thread has installed the pte first, so it
         * is no problem.
         */
-       vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
+       vm_insert_pfn(vma, vmf->address, pfn);
 
        return VM_FAULT_NOPAGE;
 }
index 286447a83dab809e0522e461c7e6ca416e997462..26ec39ddf21ffa4f58d09e62dda0fab90e46ae5f 100644 (file)
@@ -328,7 +328,6 @@ static phys_addr_t pgoff_to_phys(struct dax_dev *dax_dev, pgoff_t pgoff,
 static int __dax_dev_fault(struct dax_dev *dax_dev, struct vm_area_struct *vma,
                struct vm_fault *vmf)
 {
-       unsigned long vaddr = (unsigned long) vmf->virtual_address;
        struct device *dev = &dax_dev->dev;
        struct dax_region *dax_region;
        int rc = VM_FAULT_SIGBUS;
@@ -353,7 +352,7 @@ static int __dax_dev_fault(struct dax_dev *dax_dev, struct vm_area_struct *vma,
 
        pfn = phys_to_pfn_t(phys, dax_region->pfn_flags);
 
-       rc = vm_insert_mixed(vma, vaddr, pfn);
+       rc = vm_insert_mixed(vma, vmf->address, pfn);
 
        if (rc == -ENOMEM)
                return VM_FAULT_OOM;
index 768087ddb046d1b483eb2eebafcd1298b80541fa..a293c8be232c41c7c133b95445801a56844c2e92 100644 (file)
 static int armada_gem_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct armada_gem_object *obj = drm_to_armada_gem(vma->vm_private_data);
-       unsigned long addr = (unsigned long)vmf->virtual_address;
        unsigned long pfn = obj->phys_addr >> PAGE_SHIFT;
        int ret;
 
-       pfn += (addr - vma->vm_start) >> PAGE_SHIFT;
-       ret = vm_insert_pfn(vma, addr, pfn);
+       pfn += (vmf->address - vma->vm_start) >> PAGE_SHIFT;
+       ret = vm_insert_pfn(vma, vmf->address, pfn);
 
        switch (ret) {
        case 0:
index caa4e4ca616dbe3100c006f0453d504942049e26..bd311c77c25447fdc0d167f47dbdd02a2312072f 100644 (file)
@@ -124,8 +124,7 @@ static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
                 * Using vm_pgoff as a selector forces us to use this unusual
                 * addressing scheme.
                 */
-               resource_size_t offset = (unsigned long)vmf->virtual_address -
-                       vma->vm_start;
+               resource_size_t offset = vmf->address - vma->vm_start;
                resource_size_t baddr = map->offset + offset;
                struct drm_agp_mem *agpmem;
                struct page *page;
@@ -195,7 +194,7 @@ static int drm_do_vm_shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        if (!map)
                return VM_FAULT_SIGBUS; /* Nothing allocated */
 
-       offset = (unsigned long)vmf->virtual_address - vma->vm_start;
+       offset = vmf->address - vma->vm_start;
        i = (unsigned long)map->handle + offset;
        page = vmalloc_to_page((void *)i);
        if (!page)
@@ -301,7 +300,8 @@ static int drm_do_vm_dma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        if (!dma->pagelist)
                return VM_FAULT_SIGBUS; /* Nothing allocated */
 
-       offset = (unsigned long)vmf->virtual_address - vma->vm_start;   /* vm_[pg]off[set] should be 0 */
+       offset = vmf->address - vma->vm_start;
+                                       /* vm_[pg]off[set] should be 0 */
        page_nr = offset >> PAGE_SHIFT; /* page_nr could just be vmf->pgoff */
        page = virt_to_page((void *)dma->pagelist[page_nr]);
 
@@ -337,7 +337,7 @@ static int drm_do_vm_sg_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        if (!entry->pagelist)
                return VM_FAULT_SIGBUS; /* Nothing allocated */
 
-       offset = (unsigned long)vmf->virtual_address - vma->vm_start;
+       offset = vmf->address - vma->vm_start;
        map_offset = map->offset - (unsigned long)dev->sg->virtual;
        page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
        page = entry->pagelist[page_offset];
index 6f5dfabb3096999726adffbc882332c487ba1fd9..114dddbd297bacf36406b7a4abdff39e71cdd81b 100644 (file)
@@ -202,15 +202,14 @@ int etnaviv_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        }
 
        /* We don't use vmf->pgoff since that has the fake offset: */
-       pgoff = ((unsigned long)vmf->virtual_address -
-                       vma->vm_start) >> PAGE_SHIFT;
+       pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
 
        page = pages[pgoff];
 
-       VERB("Inserting %p pfn %lx, pa %lx", vmf->virtual_address,
+       VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
             page_to_pfn(page), page_to_pfn(page) << PAGE_SHIFT);
 
-       ret = vm_insert_page(vma, (unsigned long)vmf->virtual_address, page);
+       ret = vm_insert_page(vma, vmf->address, page);
 
 out:
        switch (ret) {
index ea7a18230888a252da6dbfefc03b001b52133fc3..57b81460fec88743816e1f6ccaefcc2c109728af 100644 (file)
@@ -455,8 +455,7 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        pgoff_t page_offset;
        int ret;
 
-       page_offset = ((unsigned long)vmf->virtual_address -
-                       vma->vm_start) >> PAGE_SHIFT;
+       page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
 
        if (page_offset >= (exynos_gem->size >> PAGE_SHIFT)) {
                DRM_ERROR("invalid page offset\n");
@@ -465,8 +464,7 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        }
 
        pfn = page_to_pfn(exynos_gem->pages[page_offset]);
-       ret = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address,
-                       __pfn_to_pfn_t(pfn, PFN_DEV));
+       ret = vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV));
 
 out:
        switch (ret) {
index 4071b2d1e8cfcda44d9479e0a457f312df8cdc76..8b44fa542562205d069a3ed6da29fd34c8a7d41d 100644 (file)
@@ -125,7 +125,7 @@ static int psbfb_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
                                  psbfb->gtt->offset;
 
        page_num = vma_pages(vma);
-       address = (unsigned long)vmf->virtual_address - (vmf->pgoff << PAGE_SHIFT);
+       address = vmf->address - (vmf->pgoff << PAGE_SHIFT);
 
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
index 6d1cb6b370b194742745bc5a005f43e43a1a823a..527c629176603a2369a186b4128785c1c51723ad 100644 (file)
@@ -197,15 +197,14 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 
        /* Page relative to the VMA start - we must calculate this ourselves
           because vmf->pgoff is the fake GEM offset */
-       page_offset = ((unsigned long) vmf->virtual_address - vma->vm_start)
-                               >> PAGE_SHIFT;
+       page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
 
        /* CPU view of the page, don't go via the GART for CPU writes */
        if (r->stolen)
                pfn = (dev_priv->stolen_base + r->offset) >> PAGE_SHIFT;
        else
                pfn = page_to_pfn(r->pages[page_offset]);
-       ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
+       ret = vm_insert_pfn(vma, vmf->address, pfn);
 
 fail:
        mutex_unlock(&dev_priv->mmap_mutex);
index d0dcaf35b4298c7c58440881597b3ad4b76522f0..412f3513f269b4a96217f814aa0d882a27a3e1e5 100644 (file)
@@ -1796,8 +1796,7 @@ int i915_gem_fault(struct vm_area_struct *area, struct vm_fault *vmf)
        int ret;
 
        /* We don't use vmf->pgoff since that has the fake offset */
-       page_offset = ((unsigned long)vmf->virtual_address - area->vm_start) >>
-               PAGE_SHIFT;
+       page_offset = (vmf->address - area->vm_start) >> PAGE_SHIFT;
 
        trace_i915_gem_object_fault(obj, page_offset, true, write);
 
index cd06cfd94687fbac93412ed394dff72af3d47018..d8bc59c7e26142b377623a6736c575b30f6eeea2 100644 (file)
@@ -225,16 +225,14 @@ int msm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        }
 
        /* We don't use vmf->pgoff since that has the fake offset: */
-       pgoff = ((unsigned long)vmf->virtual_address -
-                       vma->vm_start) >> PAGE_SHIFT;
+       pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
 
        pfn = page_to_pfn(pages[pgoff]);
 
-       VERB("Inserting %p pfn %lx, pa %lx", vmf->virtual_address,
+       VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
                        pfn, pfn << PAGE_SHIFT);
 
-       ret = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address,
-                       __pfn_to_pfn_t(pfn, PFN_DEV));
+       ret = vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV));
 
 out_unlock:
        mutex_unlock(&dev->struct_mutex);
index d4e1e11466f80733dc3f393c6213c83c7027a354..4a90c690f09e4e7b7bb8645ad4e09b2d68cbd0e5 100644 (file)
@@ -398,8 +398,7 @@ static int fault_1d(struct drm_gem_object *obj,
        pgoff_t pgoff;
 
        /* We don't use vmf->pgoff since that has the fake offset: */
-       pgoff = ((unsigned long)vmf->virtual_address -
-                       vma->vm_start) >> PAGE_SHIFT;
+       pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
 
        if (omap_obj->pages) {
                omap_gem_cpu_sync(obj, pgoff);
@@ -409,11 +408,10 @@ static int fault_1d(struct drm_gem_object *obj,
                pfn = (omap_obj->paddr >> PAGE_SHIFT) + pgoff;
        }
 
-       VERB("Inserting %p pfn %lx, pa %lx", vmf->virtual_address,
+       VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
                        pfn, pfn << PAGE_SHIFT);
 
-       return vm_insert_mixed(vma, (unsigned long)vmf->virtual_address,
-                       __pfn_to_pfn_t(pfn, PFN_DEV));
+       return vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV));
 }
 
 /* Special handling for the case of faulting in 2d tiled buffers */
@@ -427,7 +425,7 @@ static int fault_2d(struct drm_gem_object *obj,
        struct page *pages[64];  /* XXX is this too much to have on stack? */
        unsigned long pfn;
        pgoff_t pgoff, base_pgoff;
-       void __user *vaddr;
+       unsigned long vaddr;
        int i, ret, slots;
 
        /*
@@ -447,8 +445,7 @@ static int fault_2d(struct drm_gem_object *obj,
        const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE);
 
        /* We don't use vmf->pgoff since that has the fake offset: */
-       pgoff = ((unsigned long)vmf->virtual_address -
-                       vma->vm_start) >> PAGE_SHIFT;
+       pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
 
        /*
         * Actual address we start mapping at is rounded down to previous slot
@@ -459,7 +456,7 @@ static int fault_2d(struct drm_gem_object *obj,
        /* figure out buffer width in slots */
        slots = omap_obj->width >> priv->usergart[fmt].slot_shift;
 
-       vaddr = vmf->virtual_address - ((pgoff - base_pgoff) << PAGE_SHIFT);
+       vaddr = vmf->address - ((pgoff - base_pgoff) << PAGE_SHIFT);
 
        entry = &priv->usergart[fmt].entry[priv->usergart[fmt].last];
 
@@ -503,12 +500,11 @@ static int fault_2d(struct drm_gem_object *obj,
 
        pfn = entry->paddr >> PAGE_SHIFT;
 
-       VERB("Inserting %p pfn %lx, pa %lx", vmf->virtual_address,
+       VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
                        pfn, pfn << PAGE_SHIFT);
 
        for (i = n; i > 0; i--) {
-               vm_insert_mixed(vma, (unsigned long)vaddr,
-                               __pfn_to_pfn_t(pfn, PFN_DEV));
+               vm_insert_mixed(vma, vaddr, __pfn_to_pfn_t(pfn, PFN_DEV));
                pfn += priv->usergart[fmt].stride_pfn;
                vaddr += PAGE_SIZE * m;
        }
index c08e5279eeac9934e00357afd1a13ac445d33937..7d853e6b5ff0f38cd70262547cb4f92580164054 100644 (file)
@@ -452,10 +452,10 @@ static int tegra_bo_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        if (!bo->pages)
                return VM_FAULT_SIGBUS;
 
-       offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >> PAGE_SHIFT;
+       offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
        page = bo->pages[offset];
 
-       err = vm_insert_page(vma, (unsigned long)vmf->virtual_address, page);
+       err = vm_insert_page(vma, vmf->address, page);
        switch (err) {
        case -EAGAIN:
        case 0:
index 4748aedc933abdcb752f7bd01f92310de5459850..68ef993ab431f8a6573f1abd01700f78ddbb7f2e 100644 (file)
@@ -101,7 +101,7 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        struct page *page;
        int ret;
        int i;
-       unsigned long address = (unsigned long)vmf->virtual_address;
+       unsigned long address = vmf->address;
        int retval = VM_FAULT_NOPAGE;
        struct ttm_mem_type_manager *man =
                &bdev->man[bo->mem.mem_type];
index 818e70712b18772c5f40233bf7dee01e88ff32a1..3c0c4bd3f7506f56c165d457ba68841e9f987a57 100644 (file)
@@ -107,14 +107,13 @@ int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        unsigned int page_offset;
        int ret = 0;
 
-       page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >>
-               PAGE_SHIFT;
+       page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
 
        if (!obj->pages)
                return VM_FAULT_SIGBUS;
 
        page = obj->pages[page_offset];
-       ret = vm_insert_page(vma, (unsigned long)vmf->virtual_address, page);
+       ret = vm_insert_page(vma, vmf->address, page);
        switch (ret) {
        case -EAGAIN:
        case 0:
index f36c14729b5547b2a36f67b65255b73618063919..477e07f0ecb674e906994595e60a948e79896c30 100644 (file)
@@ -54,7 +54,7 @@ static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct drm_vgem_gem_object *obj = vma->vm_private_data;
        /* We don't use vmf->pgoff since that has the fake offset */
-       unsigned long vaddr = (unsigned long)vmf->virtual_address;
+       unsigned long vaddr = vmf->address;
        struct page *page;
 
        page = shmem_read_mapping_page(file_inode(obj->base.filp)->i_mapping,
index 1db0af6c7f94810bf9270b0ebb5961de6b1802a5..ba63ca57ed7ebe0bf47cb6826b66e22518ca02ab 100644 (file)
@@ -439,13 +439,12 @@ static int videobuf_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        struct page *page;
 
        dprintk(3, "fault: fault @ %08lx [vma %08lx-%08lx]\n",
-               (unsigned long)vmf->virtual_address,
-               vma->vm_start, vma->vm_end);
+               vmf->address, vma->vm_start, vma->vm_end);
 
        page = alloc_page(GFP_USER | __GFP_DMA32);
        if (!page)
                return VM_FAULT_OOM;
-       clear_user_highpage(page, (unsigned long)vmf->virtual_address);
+       clear_user_highpage(page, vmf->address);
        vmf->page = page;
 
        return 0;
index 5e506c19108ad22da4a002957fd056711138b0f3..5d36dcc7f47efd71c175c3a92e822b6cc227efb7 100644 (file)
@@ -117,13 +117,12 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master,
 static int cxl_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct cxl_context *ctx = vma->vm_file->private_data;
-       unsigned long address = (unsigned long)vmf->virtual_address;
        u64 area, offset;
 
        offset = vmf->pgoff << PAGE_SHIFT;
 
        pr_devel("%s: pe: %i address: 0x%lx offset: 0x%llx\n",
-                       __func__, ctx->pe, address, offset);
+                       __func__, ctx->pe, vmf->address, offset);
 
        if (ctx->afu->current_mode == CXL_MODE_DEDICATED) {
                area = ctx->afu->psn_phys;
@@ -155,7 +154,7 @@ static int cxl_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
                return VM_FAULT_SIGBUS;
        }
 
-       vm_insert_pfn(vma, address, (area + offset) >> PAGE_SHIFT);
+       vm_insert_pfn(vma, vmf->address, (area + offset) >> PAGE_SHIFT);
 
        mutex_unlock(&ctx->status_mutex);
 
index 33741ad4a74a0ee19af50cac294d52f5aa5726ab..af2e077da4b89402d3b256de648e0cbaadd17f4e 100644 (file)
@@ -932,7 +932,7 @@ int gru_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        unsigned long paddr, vaddr;
        unsigned long expires;
 
-       vaddr = (unsigned long)vmf->virtual_address;
+       vaddr = vmf->address;
        gru_dbg(grudev, "vma %p, vaddr 0x%lx (0x%lx)\n",
                vma, vaddr, GSEG_BASE(vaddr));
        STAT(nopfn);
index d5cc3070e83f9cac62667917c02616341dd24042..b653451843c84e81cdbea96fc0c8c006832e24c1 100644 (file)
@@ -882,7 +882,7 @@ static int ion_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        BUG_ON(!buffer->pages || !buffer->pages[vmf->pgoff]);
 
        pfn = page_to_pfn(ion_buffer_page(buffer->pages[vmf->pgoff]));
-       ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
+       ret = vm_insert_pfn(vma, vmf->address, pfn);
        mutex_unlock(&buffer->lock);
        if (ret)
                return VM_FAULT_ERROR;
index 0b6d388d8aa4a50708288c76e4ec053f8ace6b19..697cbfbe937405810e7c56a5aa5c93071646b44f 100644 (file)
@@ -1014,7 +1014,7 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
                       "page %p map %p index %lu flags %lx count %u priv %0lx: got addr %p type NOPAGE\n",
                       vmf->page, vmf->page->mapping, vmf->page->index,
                       (long)vmf->page->flags, page_count(vmf->page),
-                      page_private(vmf->page), vmf->virtual_address);
+                      page_private(vmf->page), (void *)vmf->address);
                if (unlikely(!(cfio->ft_flags & VM_FAULT_LOCKED))) {
                        lock_page(vmf->page);
                        cfio->ft_flags |= VM_FAULT_LOCKED;
@@ -1025,12 +1025,12 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
        }
 
        if (cfio->ft_flags & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) {
-               CDEBUG(D_PAGE, "got addr %p - SIGBUS\n", vmf->virtual_address);
+               CDEBUG(D_PAGE, "got addr %p - SIGBUS\n", (void *)vmf->address);
                return -EFAULT;
        }
 
        if (cfio->ft_flags & VM_FAULT_OOM) {
-               CDEBUG(D_PAGE, "got addr %p - OOM\n", vmf->virtual_address);
+               CDEBUG(D_PAGE, "got addr %p - OOM\n", (void *)vmf->address);
                return -ENOMEM;
        }
 
index 702040fe2001963a663ee42fdc56ed40278e67db..6e3306f4a5250c85d7661a7145df7f8d254d5783 100644 (file)
@@ -602,7 +602,7 @@ static int privcmd_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        printk(KERN_DEBUG "privcmd_fault: vma=%p %lx-%lx, pgoff=%lx, uv=%p\n",
               vma, vma->vm_start, vma->vm_end,
-              vmf->pgoff, vmf->virtual_address);
+              vmf->pgoff, (void *)vmf->address);
 
        return VM_FAULT_SIGBUS;
 }
index 5ae8e11ad78677ef3103fc569d0959742a380370..f1dfae64b11af0fa0f1708155334a3da783c6859 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -738,7 +738,7 @@ static int dax_insert_mapping(struct address_space *mapping,
                struct block_device *bdev, sector_t sector, size_t size,
                void **entryp, struct vm_area_struct *vma, struct vm_fault *vmf)
 {
-       unsigned long vaddr = (unsigned long)vmf->virtual_address;
+       unsigned long vaddr = vmf->address;
        struct blk_dax_ctl dax = {
                .sector = sector,
                .size = size,
@@ -948,7 +948,7 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
 {
        struct address_space *mapping = vma->vm_file->f_mapping;
        struct inode *inode = mapping->host;
-       unsigned long vaddr = (unsigned long)vmf->virtual_address;
+       unsigned long vaddr = vmf->address;
        loff_t pos = (loff_t)vmf->pgoff << PAGE_SHIFT;
        sector_t sector;
        struct iomap iomap = { 0 };
index de5bcead2511bca06d09df4ff0d2882e5cb4790d..75fda0de64bf577c47f6fedb990a71acf881d240 100644 (file)
@@ -297,8 +297,6 @@ struct vm_fault {
        gfp_t gfp_mask;                 /* gfp mask to be used for allocations */
        pgoff_t pgoff;                  /* Logical page offset based on vma */
        unsigned long address;          /* Faulting virtual address */
-       void __user *virtual_address;   /* Faulting virtual address masked by
-                                        * PAGE_MASK */
        pmd_t *pmd;                     /* Pointer to pmd entry matching
                                         * the 'address'
                                         */
index 512e1c359193b50e8ea0120a280847b942ca2714..379836261d4a02eb6d0e3e210111e4d47920e130 100644 (file)
@@ -2040,7 +2040,7 @@ static int do_page_mkwrite(struct vm_area_struct *vma, struct page *page,
        struct vm_fault vmf;
        int ret;
 
-       vmf.virtual_address = (void __user *)(address & PAGE_MASK);
+       vmf.address = address & PAGE_MASK;
        vmf.pgoff = page->index;
        vmf.flags = FAULT_FLAG_WRITE|FAULT_FLAG_MKWRITE;
        vmf.gfp_mask = __get_fault_gfp_mask(vma);
@@ -2276,8 +2276,7 @@ static int wp_pfn_shared(struct vm_fault *vmf, pte_t orig_pte)
                struct vm_fault vmf2 = {
                        .page = NULL,
                        .pgoff = linear_page_index(vma, vmf->address),
-                       .virtual_address =
-                               (void __user *)(vmf->address & PAGE_MASK),
+                       .address = vmf->address,
                        .flags = FAULT_FLAG_WRITE | FAULT_FLAG_MKWRITE,
                };
                int ret;
@@ -2852,7 +2851,7 @@ static int __do_fault(struct vm_fault *vmf, pgoff_t pgoff,
        struct vm_fault vmf2;
        int ret;
 
-       vmf2.virtual_address = (void __user *)(vmf->address & PAGE_MASK);
+       vmf2.address = vmf->address;
        vmf2.pgoff = pgoff;
        vmf2.flags = vmf->flags;
        vmf2.page = NULL;
@@ -3612,7 +3611,7 @@ static int __handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
 {
        struct vm_fault vmf = {
                .vma = vma,
-               .address = address,
+               .address = address & PAGE_MASK,
                .flags = flags,
        };
        struct mm_struct *mm = vma->vm_mm;