* [PATCH] mm: mlock: check if vma is locked using & instead of && operator
@ 2016-09-09 10:46 Colin King
2016-09-09 11:52 ` Alexey Klimov
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2016-09-09 10:46 UTC (permalink / raw)
To: Andrew Morton, Vlastimil Babka, Kirill A . Shutemov, Michal Hocko,
Eric B Munson, Simon Guo, Mel Gorman, Alexey Klimov, linux-mm
Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The check to see if a vma is locked is using the operator && and
should be using the bitwise operator & to see if the VM_LOCKED bit
is set. Fix this to use & instead.
Fixes: ae38c3be005ee ("mm: mlock: check against vma for actual mlock() size")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
mm/mlock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/mlock.c b/mm/mlock.c
index fafbb78..f5b1d07 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -643,7 +643,7 @@ static int count_mm_mlocked_page_nr(struct mm_struct *mm,
for (; vma ; vma = vma->vm_next) {
if (start + len <= vma->vm_start)
break;
- if (vma->vm_flags && VM_LOCKED) {
+ if (vma->vm_flags & VM_LOCKED) {
if (start > vma->vm_start)
count -= (start - vma->vm_start);
if (start + len < vma->vm_end) {
--
2.9.3
--
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>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm: mlock: check if vma is locked using & instead of && operator
2016-09-09 10:46 [PATCH] mm: mlock: check if vma is locked using & instead of && operator Colin King
@ 2016-09-09 11:52 ` Alexey Klimov
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Klimov @ 2016-09-09 11:52 UTC (permalink / raw)
To: Colin King
Cc: Andrew Morton, Vlastimil Babka, Kirill A . Shutemov, Michal Hocko,
Eric B Munson, Simon Guo, Mel Gorman, linux-mm,
Linux Kernel Mailing List
Hi Colin,
On Fri, Sep 9, 2016 at 11:46 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The check to see if a vma is locked is using the operator && and
> should be using the bitwise operator & to see if the VM_LOCKED bit
> is set. Fix this to use & instead.
>
> Fixes: ae38c3be005ee ("mm: mlock: check against vma for actual mlock() size")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> mm/mlock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mlock.c b/mm/mlock.c
> index fafbb78..f5b1d07 100644
> --- a/mm/mlock.c
> +++ b/mm/mlock.c
> @@ -643,7 +643,7 @@ static int count_mm_mlocked_page_nr(struct mm_struct *mm,
> for (; vma ; vma = vma->vm_next) {
> if (start + len <= vma->vm_start)
> break;
> - if (vma->vm_flags && VM_LOCKED) {
> + if (vma->vm_flags & VM_LOCKED) {
> if (start > vma->vm_start)
> count -= (start - vma->vm_start);
> if (start + len < vma->vm_end) {
> --
I think it was already addressed in [1] by Simon Guo.
[1] http://www.spinics.net/lists/linux-mm/msg113228.html
--
Best regards,
Alexey
--
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-09 11:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-09 10:46 [PATCH] mm: mlock: check if vma is locked using & instead of && operator Colin King
2016-09-09 11:52 ` Alexey Klimov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).