[Tux3] Bug? Atom refcounting redux

OGAWA Hirofumi hirofumi at mail.parknet.co.jp
Tue Dec 2 01:44:08 PST 2008


Daniel Phillips <phillips at phunq.net> writes:

> ...or:
>
>  	if (IS_ERR(buffer = blockread(inode->map, block)))
>  		return PTR_ERR(buffer);
>
> Anybody have an opinion on whether IS_ERR works just as well in user
> space as in kernel?

It would work if kernel reserved that range as kernel space like linux.
Well, if we want to make sure it, I think we can reserve the address
range for it.

e.g. maybe

	error_base = mmap(,MAX_ERRNO + 1,PROT_NONE,,,);

        ERR_PTR(err)
        	assert(err < 0);
                return error_base + -err;

	PTR_ERR(ptr)
        	return -(long)(ptr - error_base);

	IS_ERR(ptr)
        	return (error_base < ptr && ptr <= error_base + MAX_ERRNO);
-- 
OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list