Re: [PATCH 02/21] mm: Use vmf->address instead of of vmf->virtual_address

From
Jan Kara <jack@suse.cz>
Date
2016-11-16 11:05:05
Also in
linux-fsdevel, nvdimm
Reply to
Kirill A. Shutemov, 2016-11-15
On Wed 16-11-16 00:55:31, Kirill A. Shutemov wrote:
On Fri, Nov 04, 2016 at 05:24:58AM +0100, Jan Kara wrote:
quoted
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.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 arch/powerpc/platforms/cell/spufs/file.c     |  4 ++--
 arch/x86/entry/vdso/vma.c                    |  4 ++--
 drivers/char/agp/alpha-agp.c                 |  2 +-
 drivers/char/mspec.c                         |  2 +-
 drivers/dax/dax.c                            |  2 +-
 drivers/gpu/drm/armada/armada_gem.c          |  2 +-
 drivers/gpu/drm/drm_vm.c                     | 11 ++++++-----
 drivers/gpu/drm/etnaviv/etnaviv_gem.c        |  7 +++----
 drivers/gpu/drm/exynos/exynos_drm_gem.c      |  6 +++---
 drivers/gpu/drm/gma500/framebuffer.c         |  2 +-
 drivers/gpu/drm/gma500/gem.c                 |  5 ++---
 drivers/gpu/drm/i915/i915_gem.c              |  2 +-
 drivers/gpu/drm/msm/msm_gem.c                |  7 +++----
 drivers/gpu/drm/omapdrm/omap_gem.c           | 20 +++++++++-----------
 drivers/gpu/drm/tegra/gem.c                  |  4 ++--
 drivers/gpu/drm/ttm/ttm_bo_vm.c              |  2 +-
 drivers/gpu/drm/udl/udl_gem.c                |  5 ++---
 drivers/gpu/drm/vgem/vgem_drv.c              |  2 +-
 drivers/media/v4l2-core/videobuf-dma-sg.c    |  5 ++---
 drivers/misc/cxl/context.c                   |  2 +-
 drivers/misc/sgi-gru/grumain.c               |  2 +-
 drivers/staging/android/ion/ion.c            |  2 +-
 drivers/staging/lustre/lustre/llite/vvp_io.c |  9 ++++++---
 drivers/xen/privcmd.c                        |  2 +-
 fs/dax.c                                     |  4 ++--
 include/linux/mm.h                           |  2 --
 mm/memory.c                                  |  7 +++----
 27 files changed, 59 insertions(+), 65 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 06254467e4dd..e8a31fffcdda 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -236,7 +236,7 @@ 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 address = vmf->address & PAGE_MASK;
These "& PAGE_MASK" everewhere look unnecesary. I don't think we ever
need sub-page address, do we?
Usually not AFAICT but I was not really sure in some cases (e.g. is
vm_insert_pfn() and friends really safe to call with unaligned address) so
I've decided to do a simple search-and-replace for such a wide-scale patch.
Later we can remove unnecessary masking from places where we are sure it is
not needed.

								Honza
-- 
Jan Kara [off-list ref]
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Thread (56 messages) 56 messages, 4 authors, last reply 2016-11-17
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help