Subject: Re: Uninitalized kernel variable uvm_maxkaddr
To: Bill Studenmund <wrstuden@netbsd.org>
From: Amatus <c11h15no2@yahoo.com>
List: tech-kern
Date: 05/31/2005 20:58:43
--- Bill Studenmund <wrstuden@netbsd.org> wrote:

> On Tue, May 31, 2005 at 06:57:57AM -0700, Amatus wrote:
> > Hi all, uvm_maxkaddr is never initalized before it's used. It's
> first
> > use is in uvm_pageboot_alloc() (at least on i386) where it's
> compared
> > against:
> >         if (uvm_maxkaddr < (addr + size)) {
> >                 uvm_maxkaddr = pmap_growkernel(addr + size);
> >                 if (uvm_maxkaddr < (addr + size))
> >                         panic("uvm_pageboot_alloc:
> pmap_growkernel()
> > failed");
> >         }
> > 
> > It doesn't cause a problem because it seems to always be 0 on boot
> and
> > is then set to a more reasonable value (something like
> 0xc100000000).
> > It seems to me it should be initalized in pmap_bootstrap(). Can
> someone
> > tell me why this isn't the case?
> 
> I can't speak as to _if_ it should be initialized earlier, but it
> will 
> always be initialized to zero. It doesn't just "seem" to, but it will
> 
> always be zero.
> 
> Its definition is:
> 
> vaddr_t uvm_maxkaddr;
> 
> which will cause it to be in the bss section, which will always be
> zeroed 
> on load.
> 
> Take care,
> 
> Bill
> 

Thank you, I realize *why* it's 0, but it doesn't seem kosher to me, it
really should be assigned a value somewhere in the code before being
used. It'll save lots of people from scratching their heads.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com