[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100920082856.9aa40754.rdunlap@xenotime.net>
Date: Mon, 20 Sep 2010 08:28:56 -0700
From: Randy Dunlap <rdunlap@...otime.net>
To: Rofail Qu <rofail@...il.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: A simple question of sys_
On Mon, 20 Sep 2010 16:34:26 +0800 Rofail Qu wrote:
> 2010/9/18 Randy Dunlap <rdunlap@...otime.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?
Sorry, I don't quite understand your question.
> >
> >> 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 ***
--
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