Re: IS_ERR() question

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

 



On Tue, 2002-02-26 at 10:55, Swapnil Nagle wrote:
> Petter Wahlman <petter@bluezone.no> wrote :
> 
> > I found the answer to my question when I examined the vmalloc code.
> > 
> 
> Could you please share your insight with the rest of us :)
> 
> Swapnil.
> 
> 

As I understand it, kernel pointers have redundant information because
the last 8k of the 32bit virtual address space will never be returned by
vmalloc(). 
This remaining space is reserved for an empty page, and a page for
highmem PTE's (Strangely enough this is not in the x86 specific part of
the kernel.)
The "redundant" part of the kernel pointer is therefore used to return
error codes, and the IS_ERR() checks for errors by comparing the pointer
to 0xfffffc18.
OTOH I did not understand why the author choose to check only the last
999 bytes of the pointer, or did a IMO, more readable AND operation.



Petter Wahlman.





  


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux