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] [day] [month] [year] [list]
Message-ID: <ZNEIcDk7tQktPMGd@smile.fi.intel.com>
Date:   Mon, 7 Aug 2023 18:06:24 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Marc Zyngier <maz@...nel.org>
Cc:     Johan Hovold <johan+linaro@...nel.org>,
        linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v1 1/1] irqdomain: Refactor error path in
 __irq_domain_alloc_fwnode()

On Fri, Aug 04, 2023 at 11:24:02PM +0100, Marc Zyngier wrote:
> On Fri, 04 Aug 2023 21:12:11 +0100,
> Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
> > On Fri, Aug 04, 2023 at 06:33:07PM +0100, Marc Zyngier wrote:
> > > On 2023-08-04 17:49, Andy Shevchenko wrote:

...

> > > >  		n = kasprintf(GFP_KERNEL, "irqchip@%pa", pa);
> > > >  		break;
> > > >  	}
> > > > -
> > > > -	if (!fwid || !n) {
> > > > +	if (!n) {
> > > >  		kfree(fwid);
> > > > -		kfree(n);
> > > >  		return NULL;
> > > >  	}
> > > 
> > > What are you trying to fix?
> > 
> > I'm not trying to fix anything (there is no such statement from me),
> > but I would think of some micro-optimization (speedup boot for
> > unnoticeable time? Dunno.).
> 
> Error handling paths rarely qualify as an optimisation.

OK.

...

> > > We have a common error handling path, which makes it easy to
> > > track the memory management. I don't think this sort of bike
> > > shedding adds much to the maintainability of this code.
> > 
> > Your call, of course, but I not often see in the kernel two or three attempts
> > to allocate some memory and have grouped check for the failure.
> 
> Things like this[1]?

Yes.

> Well, this is a pattern I use often enough. Maybe
> it isn't everybody's taste, but it suits me.

Understand. Thanks for review!

> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/irqchip/irq-gic-v3-its.c#n3438

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ