Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1479863 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2016-09-09 12:50 +0200 |
| Last post | 2016-09-09 14:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] mm: mlock: check if vma is locked using & instead of && operator Colin King <colin.king@canonical.com> - 2016-09-09 12:50 +0200
Re: [PATCH] mm: mlock: check if vma is locked using & instead of && operator Alexey Klimov <klimov.linux@gmail.com> - 2016-09-09 14:00 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2016-09-09 12:50 +0200 |
| Subject | [PATCH] mm: mlock: check if vma is locked using & instead of && operator |
| Message-ID | <sfrxE-1Je-3@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Alexey Klimov <klimov.linux@gmail.com> |
|---|---|
| Date | 2016-09-09 14:00 +0200 |
| Message-ID | <sfsDn-2kg-9@gated-at.bofh.it> |
| In reply to | #1479863 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web