Skip to content

Commit

Permalink
[NET]: Make sure ctl buffer is aligned properly in sys_sendmsg().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Williamson authored and David S. Miller committed Sep 26, 2005
1 parent 8ddec74 commit b9d717a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b9d717a

Please sign in to comment.