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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 16-11-16 14:32:48, Kirill A. Shutemov wrote:
> On Wed, Nov 16, 2016 at 12:05:05PM +0100, Jan Kara wrote:
> > 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:
> > > > 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@xxxxxxx>
> > > > ---
> > > >  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.
> 
> I think it should be fine just to zero out ~PAGE_MASK bits of the address
> on entrance into handle_mm_fault() or where vmf is initialized.

OK, I wasn't really sure whether something in mm does not rely on low bits
being accurate. But if you also don't think anything relies on those bits,
I can try it we'll see if something breaks :)

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux