linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs-utils: Fix C aliasing rules violation in nfs_getrpccaller()
@ 2010-07-06 16:59 Chuck Lever
       [not found] ` <20100706165849.4436.13124.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Chuck Lever @ 2010-07-06 16:59 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

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@oracle.com>
---
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 */


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nfs-utils: Fix C aliasing rules violation in nfs_getrpccaller()
       [not found] ` <20100706165849.4436.13124.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
@ 2010-07-19 14:10   ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2010-07-19 14:10 UTC (permalink / raw)
  To: Chuck Lever; +Cc: linux-nfs



On 07/06/2010 12:59 PM, Chuck Lever wrote:
> 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:
> ../../support/include/rpcmisc.h:58: warning: dereferencing type-punne=
d
> pointer might break strict-aliasing rules
> ../../support/include/rpcmisc.h: In function =E2=80=98nfs_getrpccalle=
r=E2=80=99:
> ../../support/include/rpcmisc.h:63: warning: dereferencing type-punne=
d
> pointer might break strict-aliasing rules
>=20
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> 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.

>=20
>=20
>  support/include/rpcmisc.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>=20
> 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;
> =20
>  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);
>  }
> =20
>  static inline struct sockaddr *nfs_getrpccaller(SVCXPRT *xprt)
>  {
> -	return (struct sockaddr *)svc_getcaller(xprt);
> +	return (struct sockaddr *)(char *)svc_getcaller(xprt);
>  }
> =20
>  #endif /* RPCMISC_H */
>=20

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-19 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-06 16:59 [PATCH] nfs-utils: Fix C aliasing rules violation in nfs_getrpccaller() Chuck Lever
     [not found] ` <20100706165849.4436.13124.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2010-07-19 14:10   ` Steve Dickson

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).