sctp: remove unnecessary asoc in sctp_has_association
authorXin Long <lucien.xin@gmail.com>
Mon, 26 Mar 2018 08:55:00 +0000 (16:55 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Mar 2018 14:22:11 +0000 (10:22 -0400)
After Commit dae399d7fdee ("sctp: hold transport instead of assoc
when lookup assoc in rx path"), it put transport instead of asoc
in sctp_has_association. Variable 'asoc' is not used any more.

So this patch is to remove it, while at it,  it also changes the
return type of sctp_has_association to bool, and does the same
for it's caller sctp_endpoint_is_peeled_off.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/structs.h
net/sctp/endpointola.c
net/sctp/input.c

index 012fb3e2f4cf60514c1f9544012ad54c565e0ad7..c63249ea34c399592df0b65fe192b69d214e7d1f 100644 (file)
@@ -1341,12 +1341,12 @@ struct sctp_association *sctp_endpoint_lookup_assoc(
        const struct sctp_endpoint *ep,
        const union sctp_addr *paddr,
        struct sctp_transport **);
-int sctp_endpoint_is_peeled_off(struct sctp_endpoint *,
-                               const union sctp_addr *);
+bool sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep,
+                                const union sctp_addr *paddr);
 struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *,
                                        struct net *, const union sctp_addr *);
-int sctp_has_association(struct net *net, const union sctp_addr *laddr,
-                        const union sctp_addr *paddr);
+bool sctp_has_association(struct net *net, const union sctp_addr *laddr,
+                         const union sctp_addr *paddr);
 
 int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
                     const struct sctp_association *asoc,
index 8b31468165197428239fe7e6ddece6f60878c39f..e2f5a3ee41a7140c3865c406bf8e1d4f83044e5a 100644 (file)
@@ -349,8 +349,8 @@ out:
 /* Look for any peeled off association from the endpoint that matches the
  * given peer address.
  */
-int sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep,
-                               const union sctp_addr *paddr)
+bool sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep,
+                                const union sctp_addr *paddr)
 {
        struct sctp_sockaddr_entry *addr;
        struct sctp_bind_addr *bp;
@@ -362,10 +362,10 @@ int sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep,
         */
        list_for_each_entry(addr, &bp->address_list, list) {
                if (sctp_has_association(net, &addr->a, paddr))
-                       return 1;
+                       return true;
        }
 
-       return 0;
+       return false;
 }
 
 /* Do delayed input processing.  This is scheduled by sctp_rcv().
index b381d78548ac7391ba64ebff333835d0627ffdb8..ba8a6e6c36fae998b5590a803c90c28d8302d063 100644 (file)
@@ -1010,19 +1010,18 @@ struct sctp_association *sctp_lookup_association(struct net *net,
 }
 
 /* Is there an association matching the given local and peer addresses? */
-int sctp_has_association(struct net *net,
-                        const union sctp_addr *laddr,
-                        const union sctp_addr *paddr)
+bool sctp_has_association(struct net *net,
+                         const union sctp_addr *laddr,
+                         const union sctp_addr *paddr)
 {
-       struct sctp_association *asoc;
        struct sctp_transport *transport;
 
-       if ((asoc = sctp_lookup_association(net, laddr, paddr, &transport))) {
+       if (sctp_lookup_association(net, laddr, paddr, &transport)) {
                sctp_transport_put(transport);
-               return 1;
+               return true;
        }
 
-       return 0;
+       return false;
 }
 
 /*