Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bc375ea7efcda0450b7cba9b3514e76d2e1cea79
Commit:     bc375ea7efcda0450b7cba9b3514e76d2e1cea79
Parent:     1d51c69fb6e61054cd6cc485f9bef77d19d82751
Author:     David S. Miller <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 12 13:35:59 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Thu Apr 12 13:35:59 2007 -0700

    [SUNRPC]: Make sure on-stack cmsg buffer is properly aligned.
    
    Based upon a report from Meelis Roos.
    
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/sunrpc/svcsock.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 593f62f..2772fee 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -452,6 +452,8 @@ union svc_pktinfo_u {
        struct in_pktinfo pkti;
        struct in6_pktinfo pkti6;
 };
+#define SVC_PKTINFO_SPACE \
+       CMSG_SPACE(sizeof(union svc_pktinfo_u))
 
 static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh)
 {
@@ -491,8 +493,11 @@ svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr)
        struct svc_sock *svsk = rqstp->rq_sock;
        struct socket   *sock = svsk->sk_sock;
        int             slen;
-       char            buffer[CMSG_SPACE(sizeof(union svc_pktinfo_u))];
-       struct cmsghdr *cmh = (struct cmsghdr *)buffer;
+       union {
+               struct cmsghdr  hdr;
+               long            all[SVC_PKTINFO_SPACE / sizeof(long)];
+       } buffer;
+       struct cmsghdr *cmh = &buffer.hdr;
        int             len = 0;
        int             result;
        int             size;
@@ -745,8 +750,11 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
        struct svc_sock *svsk = rqstp->rq_sock;
        struct svc_serv *serv = svsk->sk_server;
        struct sk_buff  *skb;
-       char            buffer[CMSG_SPACE(sizeof(union svc_pktinfo_u))];
-       struct cmsghdr *cmh = (struct cmsghdr *)buffer;
+       union {
+               struct cmsghdr  hdr;
+               long            all[SVC_PKTINFO_SPACE / sizeof(long)];
+       } buffer;
+       struct cmsghdr *cmh = &buffer.hdr;
        int             err, len;
        struct msghdr msg = {
                .msg_name = svc_addr(rqstp),
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to