[PATCH 2.6.22-rc5] nfsd: fix pointer-to-int cast warning

From: Mikael Pettersson
Date: Sun Jun 17 2007 - 07:56:39 EST


nfsctl.c:write_getfs() open-codes offsetof, but does it poorly
resulting in the following warning on 64-bit machines:

fs/nfsd/nfsctl.c: In function 'write_getfs':
fs/nfsd/nfsctl.c:248: warning: cast from pointer to integer of different size

Fix: use offsetof().

Signed-off-by: Mikael Pettersson <mikpe@xxxxxxxx>

--- linux-2.6.22-rc5/fs/nfsd/nfsctl.c.~1~ 2007-04-26 14:59:37.000000000 +0200
+++ linux-2.6.22-rc5/fs/nfsd/nfsctl.c 2007-06-17 13:30:32.000000000 +0200
@@ -245,7 +245,7 @@ static ssize_t write_getfs(struct file *
}
exp_readunlock();
if (err == 0)
- err = res->fh_size + (int)&((struct knfsd_fh*)0)->fh_base;
+ err = res->fh_size + offsetof(struct knfsd_fh, fh_base);
out:
return err;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/