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

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

 



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 <[email protected]>

--- 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux