nfs-utils: Fix C aliasing rules violation in nfs_getrpccaller()
Subsystems (2)
PATCH 1/1 nfs-utils: Fix C aliasing rules violation in nfs_getrpccaller()
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
---
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(-)
support/include/rpcmisc.h +2 -2
@@ -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 */
A message that is not in the archive (sent off-list or not yet received): 20100706165849.4436.13124.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org
Quoted 4 lines · Chuck Lever
Squelch compiler warnings reported with -Wextra:
=20
In file included from statd.c:24:../../support/include/rpcmisc.h: In function =E2=80=98nfs_getrpccalle=
r_in=E2=80=99:
Quoted 1 line
../../support/include/rpcmisc.h:58: warning: dereferencing type-punne=
d
Quoted 2 lines
pointer might break strict-aliasing rules
../../support/include/rpcmisc.h: In function =E2=80=98nfs_getrpccalle=
r=E2=80=99:
Quoted 1 line
../../support/include/rpcmisc.h:63: warning: dereferencing type-punne=
d
Quoted 8 lines
pointer might break strict-aliasing rules
=20Signed-off-by Chuck Lever <[email protected]>---
Steve-
=20
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=
=2E
Committed...=20
steved.
Quoted 25 lines
=20
=20support/include/rpcmisc.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)=20
support/include/rpcmisc.h +0
-0@@ -60,12 +60,12 @@ extern int _rpcsvcdirty;=20
static inline structsockaddr_in*nfs_getrpccaller_in(SVCXPRT *xprt) {support/include/rpcmisc.h +1
-1-return (struct sockaddr_in *)svc_getcaller (xprt); +return (struct sockaddr_in *)(char *)svc_getcaller (xprt); }=20
static inline struct sockaddr *nfs_getrpccaller(SVCXPRT *xprt) {support/include/rpcmisc.h +1
-1-return (struct sockaddr *)svc_getcaller (xprt); +return (struct sockaddr *)(char *)svc_getcaller (xprt); }=20
#endif /*RPCMISC_H*/
=20