A simple question of sys_

From: Rofail Qu
Date: Fri Sep 17 2010 - 02:58:39 EST


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!
IS_ERR(x) seems to use on judge if "x" is a 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?
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/