linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>,
	linux-man@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Tejun Heo <tj@kernel.org>, Andrew Morton <akpm@osdl.org>,
	Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Bad error return after find_vma() in PR_SET_MM code
Date: Sun, 15 Apr 2012 16:00:17 +1200	[thread overview]
Message-ID: <CAKgNAkjWdy_SYaJsNXUOv7cNL2xwZNW7FCdRsT6wiRFb0dmetw@mail.gmail.com> (raw)

[Bother! Resending with corrected subject line (was "[PATCH 1/2]
prctl: Add PR_SET_MM option description")]

Cyrill,

While reviewing your patch to the prctl() manual page, I noticed the
following code in kernel/sys.c::prctl_set_mm():

       if (opt != PR_SET_MM_START_BRK && opt != PR_SET_MM_BRK) {
               /* It must be existing VMA */
               if (!vma || vma->vm_start > addr)
                       goto out;
       }

At this point, the code causes an exit with error set to zero (i.e.,
success). This looks unintended to me. Is the code correct? I suspect
a return of -EFAULT or -ENOMEM is warranted.

Cheers,

Michael

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/

             reply	other threads:[~2012-04-15  4:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-15  4:00 Michael Kerrisk (man-pages) [this message]
     [not found] ` <CAKgNAkjWdy_SYaJsNXUOv7cNL2xwZNW7FCdRsT6wiRFb0dmetw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-24 15:12   ` Bad error return after find_vma() in PR_SET_MM code KOSAKI Motohiro
     [not found]     ` <4F96C2CF.5070900-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-24 15:15       ` Cyrill Gorcunov

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=CAKgNAkjWdy_SYaJsNXUOv7cNL2xwZNW7FCdRsT6wiRFb0dmetw@mail.gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=akpm@osdl.org \
    --cc=gorcunov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=xemul@parallels.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).