[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080922214025.GE3035@ldl.fc.hp.com>
Date: Mon, 22 Sep 2008 15:40:25 -0600
From: Alex Chiang <achiang@...com>
To: Rolf Eike Beer <eike-kernel@...tec.de>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
jbarnes@...tuousgeek.org, kristen.c.accardi@...el.com,
matthew@....cx, kaneshige.kenji@...fujitsu.com
Subject: Re: [PATCH v2 02/13] PCI: prevent duplicate slot names
* Rolf Eike Beer <eike-kernel@...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
--
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