lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100921075334.GA5427@cr0.nay.redhat.com>
Date:	Tue, 21 Sep 2010 15:53:34 +0800
From:	Américo Wang <xiyou.wangcong@...il.com>
To:	Rofail Qu <rofail@...il.com>
Cc:	Américo Wang <xiyou.wangcong@...il.com>,
	linux-kernel@...r.kernel.org
Subject: Re: A simple question of sys_

On Mon, Sep 20, 2010 at 04:28:36PM +0800, Rofail Qu wrote:
>2010/9/20 Américo Wang <xiyou.wangcong@...il.com>:
>> On Fri, Sep 17, 2010 at 02:58:30PM +0800, Rofail Qu wrote:
>>>How to use macro IS_ERR() ?
>>>
>>>It defines as,
>>>...
>>>#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
>>>static inline long __must_check IS_ERR(const void *ptr)
>>>{
>>>       return IS_ERR_VALUE((unsigned long)ptr);
>>>}
>>>...
>>>so when pass x as a pointer and x>=-MAX_ERRNO (including NULL or any
>>>valid address),
>>>IS_ERR() will return true!
>>
>> NULL is not an error pointer, you missed the cast to unsigned long.
>Ahh, yeah. A stupid mistake i have.
>Thanks.
>>
>>
>>>IS_ERR(x) seems to use on judge if "x" is a valid error number, right?
>>>
>>
>> Strictly speaking, it checks if 'x' is an error pointer.
>Then what is the range of a valid pointer?
>At least less than (unsigned long)-MAX_ERRNO from this case.

Yeah, the last page in the virtual memory address is reserved,
so all but the last page are non-error addresses.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ