All of lore.kernel.org
 help / color / mirror / Atom feed
* A simple question of sys_
@ 2010-09-17  6:58 Rofail Qu
  2010-09-17 18:55 ` Randy Dunlap
  2010-09-20  7:48 ` Américo Wang
  0 siblings, 2 replies; 7+ messages in thread
From: Rofail Qu @ 2010-09-17  6:58 UTC (permalink / raw)
  To: linux-kernel

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-09-21  7:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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 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.