All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linuxppc-dev@lists.ozlabs.org, david@gibson.dropbear.id.au
Subject: Re: [PATCH 1/5] fs/hugetlbfs/inode.c: Fix pgoff alignment checking on 32-bit
Date: Tue, 19 Jul 2011 14:43:49 +1000	[thread overview]
Message-ID: <1311050629.25044.394.camel@pasglop> (raw)
In-Reply-To: <13092909493748-git-send-email-beckyb@kernel.crashing.org>

Andrew, Anybody ? Can I have an -mm ack for this ?

Cheers,
Ben.

On Tue, 2011-06-28 at 14:54 -0500, Becky Bruce wrote:
> From: Becky Bruce <beckyb@kernel.crashing.org>
> 
> This:
> 
> vma->vm_pgoff & ~(huge_page_mask(h) >> PAGE_SHIFT)
> 
> is incorrect on 32-bit.  It causes us to & the pgoff with
> something that looks like this (for a 4m hugepage): 0xfff003ff.
> The mask should be flipped and *then* shifted, to give you
> 0x0000_03fff.
> 
> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
>  fs/hugetlbfs/inode.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 7aafeb8..537a209 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -94,7 +94,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
>  	vma->vm_flags |= VM_HUGETLB | VM_RESERVED;
>  	vma->vm_ops = &hugetlb_vm_ops;
>  
> -	if (vma->vm_pgoff & ~(huge_page_mask(h) >> PAGE_SHIFT))
> +	if (vma->vm_pgoff & (~huge_page_mask(h) >> PAGE_SHIFT))
>  		return -EINVAL;
>  
>  	vma_len = (loff_t)(vma->vm_end - vma->vm_start);

WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	david@gibson.dropbear.id.au, galak@kernel.crashing.org,
	Becky Bruce <beckyb@kernel.crashing.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/5] fs/hugetlbfs/inode.c: Fix pgoff alignment checking on 32-bit
Date: Tue, 19 Jul 2011 14:43:49 +1000	[thread overview]
Message-ID: <1311050629.25044.394.camel@pasglop> (raw)
In-Reply-To: <13092909493748-git-send-email-beckyb@kernel.crashing.org>

Andrew, Anybody ? Can I have an -mm ack for this ?

Cheers,
Ben.

On Tue, 2011-06-28 at 14:54 -0500, Becky Bruce wrote:
> From: Becky Bruce <beckyb@kernel.crashing.org>
> 
> This:
> 
> vma->vm_pgoff & ~(huge_page_mask(h) >> PAGE_SHIFT)
> 
> is incorrect on 32-bit.  It causes us to & the pgoff with
> something that looks like this (for a 4m hugepage): 0xfff003ff.
> The mask should be flipped and *then* shifted, to give you
> 0x0000_03fff.
> 
> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
>  fs/hugetlbfs/inode.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 7aafeb8..537a209 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -94,7 +94,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
>  	vma->vm_flags |= VM_HUGETLB | VM_RESERVED;
>  	vma->vm_ops = &hugetlb_vm_ops;
>  
> -	if (vma->vm_pgoff & ~(huge_page_mask(h) >> PAGE_SHIFT))
> +	if (vma->vm_pgoff & (~huge_page_mask(h) >> PAGE_SHIFT))
>  		return -EINVAL;
>  
>  	vma_len = (loff_t)(vma->vm_end - vma->vm_start);



WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	david@gibson.dropbear.id.au, galak@kernel.crashing.org,
	Becky Bruce <beckyb@kernel.crashing.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/5] fs/hugetlbfs/inode.c: Fix pgoff alignment checking on 32-bit
Date: Tue, 19 Jul 2011 14:43:49 +1000	[thread overview]
Message-ID: <1311050629.25044.394.camel@pasglop> (raw)
In-Reply-To: <13092909493748-git-send-email-beckyb@kernel.crashing.org>

Andrew, Anybody ? Can I have an -mm ack for this ?

Cheers,
Ben.

On Tue, 2011-06-28 at 14:54 -0500, Becky Bruce wrote:
> From: Becky Bruce <beckyb@kernel.crashing.org>
> 
> This:
> 
> vma->vm_pgoff & ~(huge_page_mask(h) >> PAGE_SHIFT)
> 
> is incorrect on 32-bit.  It causes us to & the pgoff with
> something that looks like this (for a 4m hugepage): 0xfff003ff.
> The mask should be flipped and *then* shifted, to give you
> 0x0000_03fff.
> 
> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
>  fs/hugetlbfs/inode.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 7aafeb8..537a209 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -94,7 +94,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
>  	vma->vm_flags |= VM_HUGETLB | VM_RESERVED;
>  	vma->vm_ops = &hugetlb_vm_ops;
>  
> -	if (vma->vm_pgoff & ~(huge_page_mask(h) >> PAGE_SHIFT))
> +	if (vma->vm_pgoff & (~huge_page_mask(h) >> PAGE_SHIFT))
>  		return -EINVAL;
>  
>  	vma_len = (loff_t)(vma->vm_end - vma->vm_start);


--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-07-19  4:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-28 19:54 [PATCH 0/5] Hugetlb for 32-bit FSL PowerPC BookE Becky Bruce
2011-06-28 19:54 ` Becky Bruce
2011-06-28 19:54 ` [PATCH 1/5] fs/hugetlbfs/inode.c: Fix pgoff alignment checking on 32-bit Becky Bruce
2011-06-28 19:54   ` Becky Bruce
2011-06-28 19:54   ` [PATCH 2/5] hugetlb: add phys addr to struct huge_bootmem_page Becky Bruce
2011-06-28 19:54     ` Becky Bruce
2011-06-28 19:54     ` [PATCH 3/5] powerpc: mem_init should call memblock_is_reserved with phys_addr_t Becky Bruce
2011-06-28 19:54       ` Becky Bruce
2011-06-28 19:54       ` [PATCH 4/5] powerpc: Create next_tlbcam_idx percpu variable for FSL_BOOKE Becky Bruce
2011-06-28 19:54         ` Becky Bruce
2011-06-28 19:54         ` [PATCH 5/5] powerpc: Hugetlb for BookE Becky Bruce
2011-06-28 19:54           ` Becky Bruce
2011-07-08  4:13         ` [PATCH 4/5] powerpc: Create next_tlbcam_idx percpu variable for FSL_BOOKE Kumar Gala
2011-07-08  4:13           ` Kumar Gala
2011-06-28 21:39     ` [PATCH 2/5] hugetlb: add phys addr to struct huge_bootmem_page Benjamin Herrenschmidt
2011-06-28 21:39       ` Benjamin Herrenschmidt
2011-06-30 18:50       ` Becky Bruce
2011-06-30 18:50         ` Becky Bruce
2011-07-24 16:48         ` Tabi Timur-B04825
2011-07-24 16:48           ` Tabi Timur-B04825
2011-07-21 22:44     ` Andrew Morton
2011-07-21 22:44       ` Andrew Morton
2011-07-22 21:08       ` Becky Bruce
2011-07-22 21:08         ` Becky Bruce
2011-07-19  4:43   ` Benjamin Herrenschmidt [this message]
2011-07-19  4:43     ` [PATCH 1/5] fs/hugetlbfs/inode.c: Fix pgoff alignment checking on 32-bit Benjamin Herrenschmidt
2011-07-19  4:43     ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311050629.25044.394.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.