lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 9 Dec 2013 11:32:56 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Ilia Mirkin <imirkin@...m.mit.edu>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Namhyung Kim <namhyung.kim@....com>
Subject: Re: [PATCH 09/14] tools lib traceevent: Get rid of die() in
 add_right()

On Mon, 09 Dec 2013 15:59:26 +0900
Namhyung Kim <namhyung@...nel.org> wrote:

> Hi Ilia,
> 
> On Mon, 9 Dec 2013 01:28:26 -0500, Ilia Mirkin wrote:
> > On Mon, Dec 9, 2013 at 12:34 AM, Namhyung Kim <namhyung@...nel.org> wrote:
> >> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> >> ---
> >>  tools/lib/traceevent/parse-filter.c | 12 +++++++++---
> >>  1 file changed, 9 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
> >> index 5efe66a682bd..a1ad609a860f 100644
> >> --- a/tools/lib/traceevent/parse-filter.c
> >> +++ b/tools/lib/traceevent/parse-filter.c
> >> @@ -583,12 +583,18 @@ static int add_right(struct filter_arg *op, struct filter_arg *arg,
> >>                         op->str.type = op_type;
> >>                         op->str.field = left->field.field;
> >>                         op->str.val = strdup(str);
> >> -                       if (!op->str.val)
> >> -                               die("malloc string");
> >> +                       if (!op->str.val) {
> >> +                               show_error(error_str, "Failed to allocate string filter");
> >> +                               return -1;
> >> +                       }
> >>                         /*
> >>                          * Need a buffer to copy data for tests
> >>                          */
> >> -                       op->str.buffer = malloc_or_die(op->str.field->size + 1);
> >> +                       op->str.buffer = malloc(op->str.field->size + 1);
> >> +                       if (op->str.buffer) {
> >
> > That should probably be
> >
> > if (!op->str.buffer)
> 
> Argh.. you're right!

I was thinking that it was better to do it Namhyung's way, with:

	if (op->str.buffer == NULL)

than my preferred way of:

	if (!op->str.buffer)

because I thought this mistake is more prevalent with my way. But It's
good to know that this bug happens regardless of which way you
prefer ;-)

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ