func: static int sctp_getsockopt(struct sock *sk, int level, int char __user *optval, int __user *optlen) int len ; if ( level != SOL_SCTP )  if ( get_user ( len , optlen ) )  if ( len < 0 )  switch ( optname )  retval = sctp_getsockopt_local_addrs ( sk , len , optval , optlen ); static int sctp_getsockopt_local_addrs(struct sock *sk, int char __user *optval, int __user *optlen) struct sctp_bind_addr * bp ; struct sctp_association * asoc ; struct sctp_getaddrs getaddrs ; struct sctp_sockaddr_entry * addr ; size_t space_left ; void * addrs ; if ( len < sizeof ( struct sctp_getaddrs ) )  if ( copy_from_user ( & getaddrs , optval , sizeof ( struct sctp_getaddrs ) ) )  if ( 0 == getaddrs . assoc_id )  bp = & sctp_sk ( sk ) -> ep -> base . bind_addr; asoc = sctp_id2assoc ( sk , getaddrs . assoc_id ); struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id) struct sctp_association * asoc = NULL ; if ( ! sctp_style ( sk , UDP ) )  if ( ! sctp_sstate ( sk , ESTABLISHED ) && ! sctp_sstate ( sk , CLOSING ) )  return NULL ; return asoc ; if ( ! id || ( id == ( sctp_assoc_t ) - 1 ) )  return NULL ; asoc = ( struct sctp_association * ) idr_find ( & sctp_assocs_id , ( int ) id ); if ( ! asoc || ( asoc -> base . sk != sk ) || asoc -> base . dead )  return NULL ; return asoc ; if ( ! asoc )  bp = & asoc -> base . bind_addr; addrs = kmalloc ( space_left , GFP_USER | __GFP_NOWARN ); if ( ! addrs )  if ( sctp_list_single_entry ( & bp -> address_list ) )  addr = list_entry ( bp -> address_list . next struct sctp_sockaddr_entry , list ) if ( sctp_is_any ( sk , & addr -> a ) )  cnt = sctp_copy_laddrs ( sk , bp -> port , addrs , space_left , & bytes_copied ); static int sctp_copy_laddrs(struct sock *sk, __u16 port, void size_t space_left, int *bytes_copied) struct sctp_sockaddr_entry * addr ; union sctp_addr temp ; int addrlen ; memcpy ( & temp , & addr -> a , sizeof ( temp ) ); if ( ! temp . v4 . sin_port )  temp . v4 . sin_port = htons ( port ); addrlen = sctp_get_pf_specific ( sk -> sk_family ) -> addr_to_user ( sctp_sk ( sk ) , & temp ); memcpy ( to , & temp , addrlen ); to += addrlen; 