linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Michal Hocko <mhocko@suse.com>,
	Eric B Munson <emunson@akamai.com>,
	Simon Guo <wei.guo.simon@gmail.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Alexey Klimov <klimov.linux@gmail.com>,
	linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] mm: mlock: check if vma is locked using & instead of && operator
Date: Fri,  9 Sep 2016 11:46:37 +0100	[thread overview]
Message-ID: <20160909104637.2580-1-colin.king@canonical.com> (raw)

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>

             reply	other threads:[~2016-09-09 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 10:46 Colin King [this message]
2016-09-09 11:52 ` [PATCH] mm: mlock: check if vma is locked using & instead of && operator Alexey Klimov

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=20160909104637.2580-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=akpm@linux-foundation.org \
    --cc=emunson@akamai.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=klimov.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=vbabka@suse.cz \
    --cc=wei.guo.simon@gmail.com \
    /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 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).