On Tuesday 02 December 2008 01:44, OGAWA Hirofumi wrote: > Daniel Phillips <[EMAIL PROTECTED]> 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);
Nice! I think we should do it, and get rid of some of those horrible assumptions about NULL pointer returns, even if we can't fix every one right now (in kernel we are stuck with NULL return for sb_bread, for example). Daniel _______________________________________________ Tux3 mailing list [email protected] http://tux3.org/cgi-bin/mailman/listinfo/tux3
