Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=186e234358ba29a4094d0c8c0d3ea00f84d32a3e
Commit:     186e234358ba29a4094d0c8c0d3ea00f84d32a3e
Parent:     408f22e81ea2fcf96c80e85ee12d20ef5148bf7c
Author:     Neil Horman <[EMAIL PROTECTED]>
AuthorDate: Mon Jun 18 19:59:16 2007 -0400
Committer:  Vlad Yasevich <[EMAIL PROTECTED]>
CommitDate: Tue Jun 19 09:47:32 2007 -0400

    SCTP: Fix sctp_getsockopt_get_peer_addrs
    
        This is the split out of the patch that we agreed I should split
    out from my last patch.  It changes space_left to be computed in the same
    way the to variable is.  I know we talked about changing space_left to an
    int, but I think size_t is more appropriate, since we should never have
    negative space in our buffer, and computing using offsetof means space_left
    should now never drop below zero.
    
    Signed-off-by: Neil Horman <[EMAIL PROTECTED]>
    Acked-by: Sridhar Samudrala <[EMAIL PROTECTED]>
    Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]>
---
 net/sctp/socket.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index c1f239a..2fc0366 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4019,8 +4019,7 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, 
int len,
                return -EINVAL;
 
        to = optval + offsetof(struct sctp_getaddrs,addrs);
-       space_left = len - sizeof(struct sctp_getaddrs) -
-                       offsetof(struct sctp_getaddrs,addrs);
+       space_left = len - offsetof(struct sctp_getaddrs,addrs);
 
        list_for_each(pos, &asoc->peer.transport_addr_list) {
                from = list_entry(pos, struct sctp_transport, transports);
@@ -4327,8 +4326,8 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, 
int len,
        }
 
        to = optval + offsetof(struct sctp_getaddrs,addrs);
-       space_left = len - sizeof(struct sctp_getaddrs) -
-                        offsetof(struct sctp_getaddrs,addrs);
+       space_left = len - offsetof(struct sctp_getaddrs,addrs);
+
        addrs = kmalloc(space_left, GFP_KERNEL);
        if (!addrs)
                return -ENOMEM;
-
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