linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.22-rc5] nfsd: fix pointer-to-int cast warning
@ 2007-06-17 11:56 Mikael Pettersson
  0 siblings, 0 replies; only message in thread
From: Mikael Pettersson @ 2007-06-17 11:56 UTC (permalink / raw)
  To: neilb; +Cc: linux-kernel

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@it.uu.se>

--- 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;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-17 11:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-17 11:56 [PATCH 2.6.22-rc5] nfsd: fix pointer-to-int cast warning Mikael Pettersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).