Re: [PATCH][rfc] md: Close mem leak in userspace_ctr()

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

 



On Tue, 14 Dec 2010, Mike Snitzer wrote:

> On Mon, Dec 13 2010 at  6:40pm -0500,
> Jesper Juhl <jj@xxxxxxxxxxxxx> wrote:
> 
> > Hi,
> > 
> > There's a small memory leak in 
> > drivers/md/dm-log-userspace-base.c::userspace_ctr().
> > 
> > The call to build_constructor_string() dynamically allocates memory for 
> > its last argument, but we do not always clean up that allocated memory.
> 
> I'm not seeing a leak.
> 
> The kfree() that you've added to the build_constructor_string() failure
> path isn't needed because build_constructor_string() only returns error
> if the kzalloc() failed.
> 

Hmm, that's true, assuming that there are no bugs (and never will be) in 
strlen() or sprintf() that result in 'str_size' becoming negative the code 
is safe. That's probably a safe assumption ;-)

Sorry about the noise.

-- 
Jesper Juhl <jj@xxxxxxxxxxxxx>            http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux