jidong xiao wrote:
> I saw we call IS_ERR(ptr) after executing kthread_run() each time.
> But we don't need to call IS_ERR(ptr) after kmalloc().
>
> My understanding is,
> the kernel pointer ptr for IS_ERR to check should be page aligned, so
> its kernel address should be less than 0xfffff000(or 0xffff ffff ffff
> f000, 64bits),
>
> kthread_run returns a struct task_struct pointer,which is always page aligned,
> however the pointer returned by kmalloc() might not be page aligned,
> so we cannot use IS_ERR to check.
>
> Is my understanding correct?
>
No. There is no requirement that the pointer is page-aligned. The last
page of the address space is (in the Linux kernel) invalid by
definition, so there are in effect three kinds of pointers in the Linux
kernel: valid pointers, NULL, and ERR_PTR()s.
-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]