lkml.org 
[lkml]   [2010]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: A simple question of sys_
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?


> 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 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 ***


\
 
 \ /
  Last update: 2010-09-17 20:57    [W:0.330 / U:1.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site