Re: smatch: module_init unwinding on errors

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

 



On Thu, 5 Aug 2010, Randy Dunlap wrote:

> On Thu, 29 Jul 2010 22:18:03 +0200 Dan Carpenter wrote:
> 
> > On Thu, Jul 29, 2010 at 11:00:07AM -0700, Randy Dunlap wrote:
> > > Hi Dan,
> > > 
> > > Most drivers just use the result of request_region() as a pass/fail indicator.
> > > Only a very few of them actually save the result pointer;  mostly they just pass
> > > bar to release_region().
> > > 
> > 
> > That was another thing which was concerning me.  request_region()
> > returns freshly allocated memory.  Isn't it a leak to discard this?
> 
> If I knew the answer, I would have already replied...
> I was hoping that someone else could help out here.
> 
> I expect that if there was a leak, someone would have already noticed
> and pointed this out to us.  OTOH, this could be the last class of kernel
> leaks that needs to be fixed...  I dunno.

request_region expands to a call to __request_region, which creates the 
new memory and calls __request_resource.  __request_resource fortunately 
puts it into a tree that release_region subsequently frees.  So there is 
no problem with discarding the return value.

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


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux