]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
[NET]: Make sure ctl buffer is aligned properly in sys_sendmsg().
authorAlex Williamson <alex.williamson@hp.com>
Mon, 26 Sep 2005 21:28:02 +0000 (14:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Sep 2005 21:28:02 +0000 (14:28 -0700)
It's on the stack and declared as "unsigned char[]", but pointers
and similar can be in here thus we need to give it an explicit
alignment attribute.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/socket.c

index f9264472377f563976060325a76cab8ec96da7ce..dbd1a6851edd7921a46879dca01505fe02055611 100644 (file)
@@ -1700,7 +1700,9 @@ asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags)
        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;