All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rofail Qu <rofail@gmail.com>
To: Randy Dunlap <rdunlap@xenotime.net>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: A simple question of sys_
Date: Mon, 20 Sep 2010 16:34:26 +0800	[thread overview]
Message-ID: <AANLkTimp7yk3jNKo0L=MOSpZPVgdPiy81-pAFrGqV6P9@mail.gmail.com> (raw)
In-Reply-To: <20100917115523.3f583f8d.rdunlap@xenotime.net>

2010/9/18 Randy Dunlap <rdunlap@xenotime.net>:
> On Fri, 17 Sep 2010 14:58:30 +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!
>
> Since your conclusion is false, some part of your premise must have a problem.
> Can you find it?
Got it.
thanks any way.

>
>
>> IS_ERR(x) seems to use on judge if "x" is a valid error number, right?
>
> Yes, that's what it is for.
So in kernel, a bad pointer must have saved an valid error number, right?

>
>> So in sys_execve(),
>> ...
>>         long error;
>>       char* filename;
>>
>>       filename = getname(name);
>>       error = PTR_ERR(filename);
>>       if (IS_ERR(filename))     // <== should be IS_ERR((void *)error) or other?
>>               return error;
>>       error = do_execve(filename, argv, envp, regs);
>> ...
>>
>> Where i am wrong?
>
>
> ---
> ~Randy
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
>

  reply	other threads:[~2010-09-20  8:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-17  6:58 A simple question of sys_ Rofail Qu
2010-09-17 18:55 ` Randy Dunlap
2010-09-20  8:34   ` Rofail Qu [this message]
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

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='AANLkTimp7yk3jNKo0L=MOSpZPVgdPiy81-pAFrGqV6P9@mail.gmail.com' \
    --to=rofail@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.