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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 10 Oct 2015 23:15:43 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Julia Lawall <julia.lawall@...6.fr>
Cc:	linux-arm-kernel@...ts.infradead.org,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Russell King <linux@....linux.org.uk>,
	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
	Andrew Lunn <andrew@...n.ch>,
	Jason Cooper <jason@...edaemon.net>,
	kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
	Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH 5/5] arm: add missing of_node_put

On Saturday 10 October 2015 23:10:06 Julia Lawall wrote:
> On Sat, 10 Oct 2015, Arnd Bergmann wrote:
> 
> > On Saturday 10 October 2015 14:30:54 Julia Lawall wrote:
> > > diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
> > > index 11c54de..432ff34 100644
> > > --- a/arch/arm/kernel/devtree.c
> > > +++ b/arch/arm/kernel/devtree.c
> > > @@ -143,6 +143,7 @@ void __init arm_dt_init_cpu_maps(void)
> > >                                                "max cores %u, capping them\n",
> > >                                                cpuidx, nr_cpu_ids)) {
> > >                         cpuidx = nr_cpu_ids;
> > > +                       of_node_put(cpu);
> > >                         break;
> > >                 }
> > > 
> > 
> > The same for_each_child_of_node() loop has three 'return' statements'
> > aside from the 'break' statement here. I think you should change your
> > semantic patch to cover both cases.
> 
> It was intended to,

Ok, I saw that just after replying...

> but it seems that it's not working on the case where 
> there is no argument to return.

> In any case, it's an opportunity to ask a question.  Would one want a 
> of_node_put in front of every return, or should the returns become gotos, 
> to a single of_node_put after the current end of the function?

The two styles that I see in code I consider particularly clean are:

- have only one return statement in the function and use goto for
  error handling

- avoid the goto and have the early return.

Mixing the two tends to make the function less readable, so I'd only
change it to use gotos if it can be done nicely for all cases.

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