All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Zach Levis <zml@linux.vnet.ibm.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Evgeniy Polyakov <zbr@ioremap.net>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] exec: introduce exec_binprm() for "depth == 0" code
Date: Sun, 4 Aug 2013 16:35:27 +0200	[thread overview]
Message-ID: <20130804143527.GA18906@redhat.com> (raw)
In-Reply-To: <CAGXu5jK+8xKW3Hbzg7g7o2c3G4aWrT4Y4UBCBmaM74cUPMYnQA@mail.gmail.com>

On 08/03, Kees Cook wrote:
>
> On Thu, Aug 1, 2013 at 12:05 PM, Oleg Nesterov <oleg@redhat.com> wrote:
> > +static int exec_binprm(struct linux_binprm *bprm)
> > +{
> > +       pid_t old_pid, old_vpid;
> > +       int ret;
> > +
> > +       /* Need to fetch pid before load_binary changes it */
> > +       old_pid = current->pid;
> > +       rcu_read_lock();
> > +       old_vpid = task_pid_nr_ns(current, task_active_pid_ns(current->parent));
> > +       rcu_read_unlock();
> > +
> > +       ret = search_binary_handler(bprm);
> > +       if (ret >= 0) {
> > +               trace_sched_process_exec(current, old_pid, bprm);
> > +               ptrace_event(PTRACE_EVENT_EXEC, old_vpid);
> > +               current->did_exec = 1;
> > +       }
>
> Cleanup looks good. One idea here, though: this could be made more
> pretty by doing:
>
> if (ret < 0)
>     return ret;
>
> to avoid the indentation for the "expected" code path.

Well, I do not reallt mind. But this "if" block is simple and small,
we do we need another "return" ?

To me the code looks more readable this way, but I can redo/resend.

Oleg.


  reply	other threads:[~2013-08-04 14:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 19:04 [PATCH 0/3] exec: minor cleanups + minor fix Oleg Nesterov
2013-08-01 19:05 ` [PATCH 1/3] exec: introduce exec_binprm() for "depth == 0" code Oleg Nesterov
2013-08-03 19:05   ` Kees Cook
2013-08-04 14:35     ` Oleg Nesterov [this message]
2013-08-04 17:13       ` Kees Cook
2013-08-01 19:05 ` [PATCH 2/3] exec: kill "int depth" in search_binary_handler() Oleg Nesterov
2013-08-03 18:28   ` Kees Cook
2013-08-03 18:55     ` [PATCH v2 " Oleg Nesterov
2013-08-03 19:31       ` Kees Cook
2013-08-01 19:05 ` [PATCH 3/3] exec: proc_exec_connector() should be called only once Oleg Nesterov
2013-08-03 19:10   ` Kees Cook
2013-08-02 14:09 ` [PATCH 0/3] exec: minor cleanups + minor fix Oleg Nesterov
2013-08-02 14:38   ` Zach Levis
2013-08-04 16:30 ` Oleg Nesterov

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=20130804143527.GA18906@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zbr@ioremap.net \
    --cc=zml@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.