public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@redhat.com>,
	Namhyung Kim <namhyung.kim@lge.com>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 07/10] perf sort: Check return value of strdup()
Date: Wed, 16 Jan 2013 15:38:55 -0300	[thread overview]
Message-ID: <20130116183855.GQ5826@ghostprotocols.net> (raw)
In-Reply-To: <1358066617.1594.10.camel@leonhard>

Em Sun, Jan 13, 2013 at 05:43:37PM +0900, Namhyung Kim escreveu:
> Hi Arnaldo,
> 
> 2013-01-11 (금), 02:17 -0300, Arnaldo Carvalho de Melo:
> > Em Thu, Dec 27, 2012 at 06:11:44PM +0900, Namhyung Kim escreveu:
> > > From: Namhyung Kim <namhyung.kim@lge.com>
> > > 
> > > When setup_sorting() is called, 'str' is passed to strtok_r() but it's
> > > not checked to have a valid pointer.  As strtok_r() accepts NULL
> > > pointer on a first argument and use the third argument in that case,
> > > it can cause a trouble since our third argument, tmp, is not
> > > initialized.
> > 
> > Ok, but calling exit from here? Better to check it at the callers and
> > propagate the error, letting things like TUI/gui exit routines to
> > execute.
> 
> That's fine to me too, but currently setup_sorting() exits through
> usage_with_options() if sort_dimension__add() fails and I followed the
> convention here.  Making it to return will require changes to every
> callsites of the function.
> 
> If you think it's better to change, I can do it as well.

I think this is a good opportunity to do that :-)

I just grepped for 'setup_sorting' and we have some private ones in
builtin-kmem, for instance, that return a value and that value is
checked, etc. Good precendent :-)

- Arnaldo

  reply	other threads:[~2013-01-16 18:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-27  9:11 [PATCHSET 00/10] perf tools: Cleanups and bug fixes on sort keys Namhyung Kim
2012-12-27  9:11 ` [PATCH 01/10] perf sort: Move misplaced sort entry functions Namhyung Kim
2013-01-25 11:37   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-12-27  9:11 ` [PATCH 02/10] perf sort: Get rid of unnecessary __maybe_unused Namhyung Kim
2013-01-25 11:38   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-12-27  9:11 ` [PATCH 03/10] perf sort: Fix --sort pid output Namhyung Kim
2013-01-25 11:40   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-12-27  9:11 ` [PATCH 04/10] perf sort: Align cpu column to right Namhyung Kim
2013-01-25 11:41   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-12-27  9:11 ` [PATCH 05/10] perf sort: Calculate parent column width too Namhyung Kim
2013-01-25 11:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-12-27  9:11 ` [PATCH 06/10] perf sort: Drop ip_[lr] arguments from _sort__sym_cmp() Namhyung Kim
2013-01-11  5:16   ` Arnaldo Carvalho de Melo
2012-12-27  9:11 ` [PATCH 07/10] perf sort: Check return value of strdup() Namhyung Kim
2013-01-11  5:17   ` Arnaldo Carvalho de Melo
2013-01-13  8:43     ` Namhyung Kim
2013-01-16 18:38       ` Arnaldo Carvalho de Melo [this message]
2012-12-27  9:11 ` [PATCH 08/10] perf sort: Clean up sort__first_dimension setting Namhyung Kim
2013-01-25 11:43   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-12-27  9:11 ` [PATCH 09/10] perf sort: Separate out branch stack specific sort keys Namhyung Kim
2013-01-25 11:44   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-12-27  9:11 ` [PATCH 10/10] perf report: Update documentation for " Namhyung Kim
2013-01-25 11:45   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-12-28 11:21 ` [PATCHSET 00/10] perf tools: Cleanups and bug fixes on " Jiri Olsa

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=20130116183855.GQ5826@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    /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