netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sys_sendmsg() alignment bug fix
@ 2005-09-26 20:02 Alex Williamson
  2005-09-26 20:36 ` Andrew Morton
  2005-09-27  3:40 ` Coywolf Qi Hunt
  0 siblings, 2 replies; 6+ messages in thread
From: Alex Williamson @ 2005-09-26 20:02 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, netdev

   The patch below adds an alignment attribute to the buffer used in
sys_sendmsg().  This eliminates an unaligned access warning on ia64.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>

diff -r db9b9552a2b4 net/socket.c
--- a/net/socket.c	Sat Sep 24 23:56:08 2005
+++ b/net/socket.c	Mon Sep 26 13:44:09 2005
@@ -1700,7 +1700,9 @@
 	struct socket *sock;
 	char address[MAX_SOCK_ADDR];
 	struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
-	unsigned char ctl[sizeof(struct cmsghdr) + 20];	/* 20 is size of ipv6_pktinfo */
+	unsigned char ctl[sizeof(struct cmsghdr) + 20]
+	                  __attribute__ ((aligned (sizeof(__kernel_size_t))));
+	                  /* 20 is size of ipv6_pktinfo */
 	unsigned char *ctl_buf = ctl;
 	struct msghdr msg_sys;
 	int err, ctl_len, iov_size, total_len;

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

* Re: [PATCH] sys_sendmsg() alignment bug fix
  2005-09-26 20:02 [PATCH] sys_sendmsg() alignment bug fix Alex Williamson
@ 2005-09-26 20:36 ` Andrew Morton
  2005-09-26 21:28   ` David S. Miller
  2005-09-27  3:40 ` Coywolf Qi Hunt
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2005-09-26 20:36 UTC (permalink / raw)
  To: Alex Williamson; +Cc: linux-kernel, netdev, David S. Miller

Alex Williamson <alex.williamson@hp.com> wrote:
>
>    The patch below adds an alignment attribute to the buffer used in
> sys_sendmsg().  This eliminates an unaligned access warning on ia64.
> 

Vaguely surprised that the compiler cannot be taught to do this.

> 
> diff -r db9b9552a2b4 net/socket.c
> --- a/net/socket.c	Sat Sep 24 23:56:08 2005
> +++ b/net/socket.c	Mon Sep 26 13:44:09 2005
> @@ -1700,7 +1700,9 @@
>  	struct socket *sock;
>  	char address[MAX_SOCK_ADDR];
>  	struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
> -	unsigned char ctl[sizeof(struct cmsghdr) + 20];	/* 20 is size of ipv6_pktinfo */
> +	unsigned char ctl[sizeof(struct cmsghdr) + 20]
> +	                  __attribute__ ((aligned (sizeof(__kernel_size_t))));
> +	                  /* 20 is size of ipv6_pktinfo */
>  	unsigned char *ctl_buf = ctl;
>  	struct msghdr msg_sys;
>  	int err, ctl_len, iov_size, total_len;

OK, thanks - I'll send this on to davem.  It seems odd to be using
__kernel_size_t rather than size_t, but that's what struct cmshdr does
(also oddly).

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

* Re: [PATCH] sys_sendmsg() alignment bug fix
  2005-09-26 20:36 ` Andrew Morton
@ 2005-09-26 21:28   ` David S. Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2005-09-26 21:28 UTC (permalink / raw)
  To: akpm; +Cc: alex.williamson, linux-kernel, netdev

From: Andrew Morton <akpm@osdl.org>
Date: Mon, 26 Sep 2005 13:36:34 -0700

> OK, thanks - I'll send this on to davem.  It seems odd to be using
> __kernel_size_t rather than size_t, but that's what struct cmshdr does
> (also oddly).

Applied, thanks.

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

* Re: [PATCH] sys_sendmsg() alignment bug fix
  2005-09-26 20:02 [PATCH] sys_sendmsg() alignment bug fix Alex Williamson
  2005-09-26 20:36 ` Andrew Morton
@ 2005-09-27  3:40 ` Coywolf Qi Hunt
  2005-09-27  3:59   ` Alex Williamson
  2005-09-27  4:50   ` David S. Miller
  1 sibling, 2 replies; 6+ messages in thread
From: Coywolf Qi Hunt @ 2005-09-27  3:40 UTC (permalink / raw)
  To: Alex Williamson; +Cc: akpm, linux-kernel, netdev

On 9/27/05, Alex Williamson <alex.williamson@hp.com> wrote:
>    The patch below adds an alignment attribute to the buffer used in
> sys_sendmsg().  This eliminates an unaligned access warning on ia64.

Is this a warning fix or bug fix?
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/

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

* Re: [PATCH] sys_sendmsg() alignment bug fix
  2005-09-27  3:40 ` Coywolf Qi Hunt
@ 2005-09-27  3:59   ` Alex Williamson
  2005-09-27  4:50   ` David S. Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Alex Williamson @ 2005-09-27  3:59 UTC (permalink / raw)
  To: Coywolf Qi Hunt; +Cc: akpm, linux-kernel, netdev

On Tue, 2005-09-27 at 11:40 +0800, Coywolf Qi Hunt wrote:
> On 9/27/05, Alex Williamson <alex.williamson@hp.com> wrote:
> >    The patch below adds an alignment attribute to the buffer used in
> > sys_sendmsg().  This eliminates an unaligned access warning on ia64.
> 
> Is this a warning fix or bug fix?

  Guess I'd have to classify it as a warning fix.  ia64 is fairly
verbose about unaligned accesses by default, so the warning is printed
out runtime.

	Alex

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

* Re: [PATCH] sys_sendmsg() alignment bug fix
  2005-09-27  3:40 ` Coywolf Qi Hunt
  2005-09-27  3:59   ` Alex Williamson
@ 2005-09-27  4:50   ` David S. Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David S. Miller @ 2005-09-27  4:50 UTC (permalink / raw)
  To: coywolf; +Cc: alex.williamson, akpm, linux-kernel, netdev

From: Coywolf Qi Hunt <coywolf@gmail.com>
Date: Tue, 27 Sep 2005 11:40:38 +0800

> On 9/27/05, Alex Williamson <alex.williamson@hp.com> wrote:
> >    The patch below adds an alignment attribute to the buffer used in
> > sys_sendmsg().  This eliminates an unaligned access warning on ia64.
> 
> Is this a warning fix or bug fix?

It doesn't generate a warning, but it does generate totally
unnecessary unaligned access traps on RISC systems.

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

end of thread, other threads:[~2005-09-27  4:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-26 20:02 [PATCH] sys_sendmsg() alignment bug fix Alex Williamson
2005-09-26 20:36 ` Andrew Morton
2005-09-26 21:28   ` David S. Miller
2005-09-27  3:40 ` Coywolf Qi Hunt
2005-09-27  3:59   ` Alex Williamson
2005-09-27  4:50   ` David S. Miller

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