Re: [bug report] pinctrl: berlin: Don't leak memory if krealloc() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 12, 2016 at 08:06:40PM +0300, Dan Carpenter wrote:
> On Wed, Oct 12, 2016 at 02:36:16PM +0200, Johannes Thumshirn wrote:
> 
> > +void berlin_pinctrl_free_funcgroups(struct berlin_pinctrl *pctrl)
> > +{
> > +	struct berlin_desc_group const *desc_group;
> > +	struct berlin_desc_function const *desc_function;
> > +	int i;
> > +
> > +	for (i = 0; i < pctrl->desc->ngroups; i++) {
> > +		desc_group = pctrl->desc->groups + i;
> > +		desc_function = desc_group->functions;
> > +
> > +		while (desc_function->name) {
> > +			struct berlin_pinctrl_function
> > +				*function = pctrl->functions;
> > +
> > +			kfree(function->groups);
> 
> It looks like, we're just freeing pctrl->functions->groups over and
> over.
> 
> Not taking advantage of managed allocations has made this stuff so much
> more complicated.  I'd be tempted almost to just delete the krealloc()
> and waste a little RAM...  (I have no idea how much RAM I'm talking
> about here so maybe this is a bad idea).

Hmm yes. But I think it's best to just drop the patch from
linux-pinctrl/for-next (and the sunxi one as well as it's suffering from the
same pain). Let's get it back to the less broken state it has been in.

@Linus are you ok with dropping these patches from your queue or shall I send
you reverts?

Byte,
	Johannes

-- 
Johannes Thumshirn                                          Storage
jthumshirn@xxxxxxx                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux