[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

question about include/asm-ppc/uaccess.h on linux 2.6.0-test10



Hi all,
just a quick question. Is it the right mailing list to ask something related to the kernel 2.6?
I found a strange implementation of the #define __access_ok in the specified file.
I cannot think it is a bug and I like to know where I can post issue like this.

By the way, the problem is as follow
The implementation of this define is 
#define __access_ok(addr,size)						    \
	((addr) <= current->thread.fs.seg				    \
	 && ((size) == 0 || (size) - 1 <= current->thread.fs.seg - (addr)))

Il looks like it  checking if a given pointer is in the user address space (stack) but, 
as far as I know, on the ppc the stack is growing from the highest addresses to the
lowest.
Therefore I would have expcted something like this

#define __access_ok(addr,size)						    \
	((addr) >= current->thread.fs.seg				    \
	 && ((size) == 0 || (size) - 1 <= (addr) - current->thread.fs.seg))

This my guess is "confirmed" by the following function in the same file

extern __inline__ int strnlen_user(const char __user *str, long len)
{
	unsigned long top = current->thread.fs.seg;

	if ((unsigned long)str > top)
		return 0;
	return __strnlen_user(str, len, top);
}
where the relationship address vs thread.fs.seg is the other way round.

Thanks for your help
  Lapo

-------------------------------------------------
WebMail Tele2 http://www.tele2.it
-------------------------------------------------



Reply to: