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]
Message-ID: <1363705443.22553.60.camel@laptop>
Date:	Tue, 19 Mar 2013 16:04:03 +0100
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Namhyung Kim <namhyung@...nel.org>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...nel.org>,
	Namhyung Kim <namhyung.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH 3/9] perf util: Get rid of write_or_die() from
 trace-event-info.c

On Tue, 2013-03-19 at 10:59 -0400, Steven Rostedt wrote:
> On Tue, 2013-03-19 at 15:49 +0100, Peter Zijlstra wrote:
> > On Tue, 2013-03-19 at 10:35 -0400, Steven Rostedt wrote:
> > > What about:
> > >         int err = 0;
> > > 
> > >         err += tracing_data_header();
> > >         err += read_header_files();
> > >         [...]
> > > 
> > >         if (err < 0) {
> > >                 free(tdata);
> > >                 tdata = NULL;
> > >         }
> > > 
> > > Also, is the only clean up needed be freeing tdata?
> > 
> > I always use err |= foo() and if (err) but I suppose it doesn't matter
> > the original error codes are lost both ways which doesn't seem to be a
> > problem here.
> 
> err |= foo() is fine too. Both are better that err1, err2, err3, ...,
> errN :-)

<whinge>

The += thing has a problem where functions can return both positive and
negative values, you could get an accidental 0 (success) but coupled
with the proposed <0 test you get a much larger accident space :-)

And while totally hideous the err1..errN case preserves the actual
return codes if one would actually need those.

</whinge>

/me crawls back under his rock noaw :-)

--
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