lkml.org 
[lkml]   [2008]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 02/13] PCI: prevent duplicate slot names
* Rolf Eike Beer <eike-kernel@sf-tec.de>:
> > +
> > + /*
> > + * We hit this the first time through, which gives us
> > + * space for terminating NULL, and then every power of 10
> > + * afterwards, which gives us space to add another digit
> > + * to "name-XX..."
> > + */
> > + if (dup % width == 0) {
> > + len++;
> > + width *= 10;
> > + }
> > +
> > + new_name = krealloc(new_name, len, GFP_KERNEL);
> > + if (!new_name)
> > + goto out;
>
> If krealloc() fails you will leak the old new_name here.

Thanks for catching this. I already responded to Willy that I'm
changing it to:

kfree(new_name);
new_name = kmalloc(len, GFP_KERNEL);

That will prevent any leaks.

Thanks for the review.

/ac



\
 
 \ /
  Last update: 2008-09-22 23:43    [W:0.102 / U:0.012 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site