Re: [PATCH v6 3/6] PCI/sysfs: Fix trailing newline handling of resource_alignment_param

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

 



Hi Bjorn,

[...]
> > +	old = resource_alignment_param;
> > +	if (strlen(param)) {
> > +		resource_alignment_param = param;
> > +	} else {
> > +		kfree(resource_alignment_param);
> 
> When "strlen(param) == 0", don't we kfree resource_alignment_param
> twice?  Once here,

Yes, we should be freeing the allocation made using kstrndup() here,
this is my bad, I completely missed that the wrong variable name was
used.

> > +		resource_alignment_param = NULL;
> > +	}
> >  	spin_unlock(&resource_alignment_lock);
> > +
> > +	kfree(old);
> 
> and again here?
> 
> >  	return count;
[...]

Yes, good catch!  I am going to send v7 shortly.  Apologies!

	Krzysztof



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux