[PATCH] nfs-utils: Fix C aliasing rules violation in nfs_getrpccaller()

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

 



Squelch compiler warnings reported with -Wextra:

In file included from statd.c:24:
../../support/include/rpcmisc.h: In function ‘nfs_getrpccaller_in’:
../../support/include/rpcmisc.h:58: warning: dereferencing type-punned
pointer might break strict-aliasing rules
../../support/include/rpcmisc.h: In function ‘nfs_getrpccaller’:
../../support/include/rpcmisc.h:63: warning: dereferencing type-punned
pointer might break strict-aliasing rules

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---
Steve-

This minor clean-up patch has been floating around in my repo for a
while.  Please consider applying it for the next release of nfs-utils.


 support/include/rpcmisc.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/support/include/rpcmisc.h b/support/include/rpcmisc.h
index 1b8f411..c5847fa 100644
--- a/support/include/rpcmisc.h
+++ b/support/include/rpcmisc.h
@@ -60,12 +60,12 @@ extern int	_rpcsvcdirty;
 
 static inline struct sockaddr_in *nfs_getrpccaller_in(SVCXPRT *xprt)
 {
-	return (struct sockaddr_in *)svc_getcaller(xprt);
+	return (struct sockaddr_in *)(char *)svc_getcaller(xprt);
 }
 
 static inline struct sockaddr *nfs_getrpccaller(SVCXPRT *xprt)
 {
-	return (struct sockaddr *)svc_getcaller(xprt);
+	return (struct sockaddr *)(char *)svc_getcaller(xprt);
 }
 
 #endif /* RPCMISC_H */

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux