netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Alex Williamson <alex.williamson@hp.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] sys_sendmsg() alignment bug fix
Date: Mon, 26 Sep 2005 13:36:34 -0700	[thread overview]
Message-ID: <20050926133634.657ef4a3.akpm@osdl.org> (raw)
In-Reply-To: <1127764921.6529.60.camel@tdi>

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

  reply	other threads:[~2005-09-26 20:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-26 20:02 [PATCH] sys_sendmsg() alignment bug fix Alex Williamson
2005-09-26 20:36 ` Andrew Morton [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050926133634.657ef4a3.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=alex.williamson@hp.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).