Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-21 Thread David Brownell
On Sunday 19 August 2007, Al Viro wrote: > Use unsigned long or uintptr_t instead.  There are several places misusing > ptrdiff_t (one - in a very odd way; WTF did that cast to __user ptrdiff_t > in ntfs expect to happen, anyway?)   Fixed... > > Signed-off-by: Al Viro <[EMAIL PROTECTED]> By the

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread David Brownell
On Sunday 19 August 2007, Al Viro wrote: > On Sun, Aug 19, 2007 at 08:26:24PM -0700, David Brownell wrote: > > > ISTR the warning was the other way around: about "cast from integer > > to pointer of a different size". The __u64 came from userspace and > > the kernel pointer was only 32 bits. N

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread Al Viro
On Sun, Aug 19, 2007 at 08:26:24PM -0700, David Brownell wrote: > ISTR the warning was the other way around: about "cast from integer > to pointer of a different size". The __u64 came from userspace and > the kernel pointer was only 32 bits. Not really truncation, but GCC > could not know that

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread David Brownell
On Sunday 19 August 2007, Satyam Sharma wrote: > > > On a 32-bit arch "unsigned long" is 32-bit and pointers are 32-bit. > > > > > > On a 64-bit archi "unsigned long" is 64-bit and pointers are 64-bit. > > > > So with 32 bit userspace "unsigned long long" is the type to use > > when talking to a

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread Satyam Sharma
On Sun, 19 Aug 2007, David Brownell wrote: > On Sunday 19 August 2007, Anton Altaparmakov wrote: > > > > > > ISTR we don't *have* a uintptr_t on all architectures, or that would > > > be the appropriate thing to use in these 32/64 bit ABI scenarios. > > > > > > > > >> Use unsigned long or uintpt

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread David Brownell
On Sunday 19 August 2007, Al Viro wrote: > On Mon, Aug 20, 2007 at 01:27:13AM +0100, Anton Altaparmakov wrote: > > > And what the cast was doing I can't remember. I may well have just > > copied it from the VFS or I was perhaps trying to silence a warning > > and this happened to work... > >

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread Al Viro
On Mon, Aug 20, 2007 at 01:29:21AM +0100, Anton Altaparmakov wrote: > Hi, > > On 20 Aug 2007, at 01:19, David Brownell wrote: > >On Sunday 19 August 2007, Al Viro wrote: > >>is wrong; for one thing, it's a bad C (it's what uintptr_t is for; > >>in general > >>we are not even promised that ptrdif

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread David Brownell
On Sunday 19 August 2007, Anton Altaparmakov wrote: > > > > ISTR we don't *have* a uintptr_t on all architectures, or that would > > be the appropriate thing to use in these 32/64 bit ABI scenarios. > > > > > >> Use unsigned long or uintptr_t instead. > > > > I suspect you mean "unsigned long long"

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread Al Viro
On Mon, Aug 20, 2007 at 01:27:13AM +0100, Anton Altaparmakov wrote: > And what the cast was doing I can't remember. I may well have just > copied it from the VFS or I was perhaps trying to silence a warning > and this happened to work... ... due to sparse bug (it miscalculated address space

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread Anton Altaparmakov
Hi, On 20 Aug 2007, at 01:19, David Brownell wrote: On Sunday 19 August 2007, Al Viro wrote: is wrong; for one thing, it's a bad C (it's what uintptr_t is for; in general we are not even promised that ptrdiff_t is large enough to hold a pointer, ISTR we don't *have* a uintptr_t on all arch

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread Anton Altaparmakov
On 19 Aug 2007, at 23:55, Al Viro wrote: Use of ptrdiff_t in - if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) + if (!access_ok(VERIFY_WRITE, (u8 __user *) + (ptrdiff_t) u_tmp- >rx_buf, +

Re: [PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread David Brownell
On Sunday 19 August 2007, Al Viro wrote: > is wrong; for one thing, it's a bad C (it's what uintptr_t is for; in general > we are not even promised that ptrdiff_t is large enough to hold a pointer, ISTR we don't *have* a uintptr_t on all architectures, or that would be the appropriate thing to use

[PATCH] ptrdiff_t is not uintptr_t, damnit

2007-08-19 Thread Al Viro
Use of ptrdiff_t in - if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) + if (!access_ok(VERIFY_WRITE, (u8 __user *) + (ptrdiff_t) u_tmp->rx_buf, + u_tmp->