[klibc] [PATCH] nfsmount: defeat dummypmap compiler warning
Greg Thelen
gthelen at google.com
Wed Jan 11 15:03:12 PST 2012
Without this patch gcc 4.6 warns:
KLIBCCC usr/kinit/nfsmount/dummypmap.o
usr/kinit/nfsmount/dummypmap.c: In function 'dummy_portmap':
usr/kinit/nfsmount/dummypmap.c:191:13: warning: array subscript is below array bounds [-Warray-bounds]
Signed-off-by: Greg Thelen <gthelen at google.com>
---
usr/kinit/nfsmount/dummypmap.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/usr/kinit/nfsmount/dummypmap.c b/usr/kinit/nfsmount/dummypmap.c
index 7c5b6bc..7c4da35 100644
--- a/usr/kinit/nfsmount/dummypmap.c
+++ b/usr/kinit/nfsmount/dummypmap.c
@@ -150,7 +150,7 @@ static int dummy_portmap(int sock, FILE *portmap_file)
int pktlen, addrlen;
unsigned char pkt[65536]; /* Max UDP packet size */
/* RPC UDP packets do not include TCP fragment size */
- struct rpc_call *rpc = (struct rpc_call *) &pkt[-4];
+ struct rpc_call *rpc = (struct rpc_call *)((uintptr_t)pkt - 4);
struct rpc_auth *cred;
struct rpc_auth *vrf;
struct portmap_args *args;
--
1.7.3.1
More information about the klibc
mailing list