Re: do_mmap

Linus Torvalds (torvalds@transmeta.com)
Fri, 31 May 2002 10:56:40 -0700 (PDT)


On Fri, 31 May 2002, Thomas 'Dent' Mirlacher wrote:
>
> ok. so 0 or (NULL) is not an option, and also unnneccessary once someone
> know how the error retun is used. - wouldn't it be much more cleaner
> to convert this _ugly_ unsigned long vals into void * wherever these vals
> are carrying an address? (well at least for do_mmap*) and use ERR_PTR
> for returning, and IS_ERR for checking for an error?

Using ERR_PTR/PTR_ERR/IS_ERR is probably the correct thing to do, but
that codebase predates the "error pointer" macros by about 9 years ;)

> btw, is err should (according to alans explaination be):
>
> return (unsigned long)ptr > (unsigned long)-1024UL;

The 1000 vs 1024 thing is just another "random number". I don't know what
the right number is myself, it may be worth trying to pick one that is
uniformly easy to test against, for example. Many architectures are better
at some constants than others.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/