From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Rofail Qu <rofail@gmail.com>
Cc: "Américo Wang" <xiyou.wangcong@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: A simple question of sys_
Date: Tue, 21 Sep 2010 15:53:34 +0800 [thread overview]
Message-ID: <20100921075334.GA5427@cr0.nay.redhat.com> (raw)
In-Reply-To: <AANLkTim2NWLE4vhPL-P8JLS3bu9f=V8GqwF0xhE7S87m@mail.gmail.com>
On Mon, Sep 20, 2010 at 04:28:36PM +0800, Rofail Qu wrote:
>2010/9/20 Américo Wang <xiyou.wangcong@gmail.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.
prev parent reply other threads:[~2010-09-21 7:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-17 6:58 Rofail Qu
2010-09-17 18:55 ` Randy Dunlap
2010-09-20 8:34 ` Rofail Qu
2010-09-20 15:28 ` Randy Dunlap
2010-09-20 7:48 ` Américo Wang
2010-09-20 8:28 ` Rofail Qu
2010-09-21 7:53 ` Américo Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100921075334.GA5427@cr0.nay.redhat.com \
--to=xiyou.wangcong@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rofail@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®