netdev
[Top] [All Lists]

[PATCH - SCTP] Fix multihomed connection failures on 64-bit systems.

To: davem@xxxxxxxxxx
Subject: [PATCH - SCTP] Fix multihomed connection failures on 64-bit systems.
From: Sridhar Samudrala <sri@xxxxxxxxxx>
Date: Fri, 7 May 2004 14:51:02 -0700 (PDT)
Cc: netdev@xxxxxxxxxxx, lksctp-developers@xxxxxxxxxxxxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
Dave,

The following patch from Vladislav Yasevich fixes an SCTP issue with 64-bit
systems.
This applies to 2.4 tree also with a small offset.

[SCTP] Fix multihomed connection failures on 64-bit systems.

Avoid the use of sizeof() and pointer arithmetic to get to the end
of sctp_cookie structure. Instead use the last element peer_init which
is a zero-sized array as the offset.

diff -Nru a/net/sctp/associola.c b/net/sctp/associola.c
--- a/net/sctp/associola.c      Fri May  7 14:37:34 2004
+++ b/net/sctp/associola.c      Fri May  7 14:37:34 2004
@@ -1195,7 +1195,7 @@
 {
        int var_size2 = ntohs(cookie->peer_init->chunk_hdr.length);
        int var_size3 = cookie->raw_addr_list_len;
-       __u8 *raw = (__u8 *)cookie + sizeof(struct sctp_cookie) + var_size2;
+       __u8 *raw = (__u8 *)cookie->peer_init + var_size2;

        return sctp_raw_to_bind_addrs(&asoc->base.bind_addr, raw, var_size3,
                                      asoc->ep->base.bind_addr.port, gfp);

<Prev in Thread] Current Thread [Next in Thread>