linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Klimov <klimov.linux@gmail.com>
To: Colin King <colin.king@canonical.com>
Cc: 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>,
	linux-mm@kvack.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: mlock: check if vma is locked using & instead of && operator
Date: Fri, 9 Sep 2016 12:52:58 +0100	[thread overview]
Message-ID: <CALW4P+K_ULv97bf3VVoFVwivcB7G2MxWx5P4S4hcxdnypsRpXA@mail.gmail.com> (raw)
In-Reply-To: <20160909104637.2580-1-colin.king@canonical.com>

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>

      reply	other threads:[~2016-09-09 11:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=CALW4P+K_ULv97bf3VVoFVwivcB7G2MxWx5P4S4hcxdnypsRpXA@mail.gmail.com \
    --to=klimov.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=colin.king@canonical.com \
    --cc=emunson@akamai.com \
    --cc=kirill.shutemov@linux.intel.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).