2010-12-02 17:58:50

by Frank Filz

[permalink] [raw]
Subject: [PATCH] (updated) Fix nfs_compat_user_ino64 so it doesn't cause problems if bit 31 or 63 are set in filei

The problem was use of an int32, which when converted to a uint64
is sign extended resulting in a fileid that doesn't fit in 32 bits
even though the intent of the function is to fit the fileid into
32 bits.

Signed-off-by: Frank Filz <[email protected]>
---
fs/nfs/inode.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 314f571..7fe18a0 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -89,7 +89,11 @@ int nfs_wait_bit_killable(void *word)
*/
u64 nfs_compat_user_ino64(u64 fileid)
{
- int ino;
+#ifdef CONIFG_COMPAT
+ compat_ulong_t ino;
+#else
+ unsigned long ino;
+#endif

if (enable_ino64)
return fileid;
--
1.5.5.6





2010-12-02 18:11:33

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH] (updated) Fix nfs_compat_user_ino64 so it doesn't cause problems if bit 31 or 63 are set in filei

On Thu, 2010-12-02 at 09:58 -0800, Frank Filz wrote:
> The problem was use of an int32, which when converted to a uint64
> is sign extended resulting in a fileid that doesn't fit in 32 bits
> even though the intent of the function is to fit the fileid into
> 32 bits.
>
> Signed-off-by: Frank Filz <[email protected]>
> ---
> fs/nfs/inode.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index 314f571..7fe18a0 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -89,7 +89,11 @@ int nfs_wait_bit_killable(void *word)
> */
> u64 nfs_compat_user_ino64(u64 fileid)
> {
> - int ino;
> +#ifdef CONIFG_COMPAT
^^^^^^^ typo
> + compat_ulong_t ino;
> +#else
> + unsigned long ino;
> +#endif
>
> if (enable_ino64)
> return fileid;

--
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
http://www.netapp.com