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: <YB77MWKXW9lNmyR2@krava>
Date:   Sat, 6 Feb 2021 21:25:21 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Ingo Molnar <mingo@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Michael Petlan <mpetlan@...hat.com>,
        Ian Rogers <irogers@...gle.com>,
        Stephane Eranian <eranian@...gle.com>,
        Alexei Budankov <abudankov@...wei.com>
Subject: Re: [PATCH 06/24] perf daemon: Add config file support

On Thu, Feb 04, 2021 at 04:08:50PM +0100, Jiri Olsa wrote:

SNIP

> > > +
> > > +static void session__free(struct session *session)
> > > +{
> > > +	free(session->base);
> > > +	free(session->name);
> > > +	free(session->run);
> > 
> > zfree() so that if there is some dangling pointer to session, we'll get
> > NULL derefs
> 
> and won't be notified by crash about the error ;-) ok

oops, actualy it makes no sense to do it here, because we're
freeing session just in the next line

> 
> > 
> > > +	free(session);
> > > +}
> > > +
> > > +static void session__remove(struct session *session)
> > > +{
> > > +	list_del(&session->list);
> > 
> > list_del_init

same here

> > 
> > > +	session__free(session);
> > > +}
> > > +
> > > +static void daemon__kill(struct daemon *daemon)
> > > +{
> > > +	daemon__signal(daemon, SIGTERM);
> > > +}
> > > +
> > >  static void daemon__free(struct daemon *daemon)
> > >  {
> > > +	struct session *session, *h;
> > > +
> > > +	list_for_each_entry_safe(session, h, &daemon->sessions, list)
> > > +		session__remove(session);
> > 
> > Wouldn't be better to have:
> > 
> > 	 list_for_each_entry_safe(session, h, &daemon->sessions, list) {
> > 	 	list_del_init(&session->list);
> > 		session__free(session);
> > 	 }
> > 
> > Because naming that function "session__remove()" one thinks it is being
> > removed from some data structure, but not that it is being as well
> > deleted.

session__remove is being called also from daemon__reconfig,
so it's there not to repeat the code, I'm ok to rename it

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ