sctp: remove redundant null check on asoc
Subsystems (3)
PATCH 1/1 sctp: remove redundant null check on asoc
In sctp_err_lookup, goto out while the asoc is not NULL, so remove the check NULL. Also, in sctp_err_finish which called by sctp_v4_err and sctp_v6_err, they pass asoc to sctp_err_finish while the asoc is not NULL, so remove the check.
--- net/sctp/input.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/sctp/input.c +2 -4
@@ -536,8 +536,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,return sk; out: -if (asoc) -sctp_association_put (asoc); +sctp_association_put (asoc);return NULL ; }
@@ -545,8 +544,7 @@ out:void sctp_err_finish (struct sock *sk,struct sctp_association *asoc) {sctp_bh_unlock_sock (sk); -if (asoc) -sctp_association_put (asoc); +sctp_association_put (asoc); }/*
Signature · 1 line
1.7.12
Quoted 43 lines · Wang Weidong
In
sctp_err_lookup, goto out while the asoc is not NULL, so remove the check NULL. Also, insctp_err_finishwhich called bysctp_v4_errandsctp_v6_err, they pass asoc tosctp_err_finishwhile the asoc is not NULL, so remove the check.Signed-off-by Wang Weidong <[email protected]>--- net/sctp/input.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)net/sctp/input.c +2
-4@@ -536,8 +536,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,return sk; out: -if (asoc) -sctp_association_put (asoc); +sctp_association_put (asoc);return NULL ; }@@ -545,8 +544,7 @@ out:void sctp_err_finish (struct sock *sk,struct sctp_association *asoc) {sctp_bh_unlock_sock (sk); -if (asoc) -sctp_association_put (asoc); +sctp_association_put (asoc); }/* Signature · 7 lines
1.7.12 -- To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Seems reasonable
Quoted 6 lines · Wang Weidong
In
sctp_err_lookup, goto out while the asoc is not NULL, so remove the check NULL. Also, insctp_err_finishwhich called bysctp_v4_errandsctp_v6_err, they pass asoc tosctp_err_finishwhile the asoc is not NULL, so remove the check.Signed-off-by Wang Weidong <[email protected]>
Thanks
-vlad
Quoted 29 lines
--- net/sctp/input.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)net/sctp/input.c +2
-4@@ -536,8 +536,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,return sk; out: -if (asoc) -sctp_association_put (asoc); +sctp_association_put (asoc);return NULL ; }@@ -545,8 +544,7 @@ out:void sctp_err_finish (struct sock *sk,struct sctp_association *asoc) {sctp_bh_unlock_sock (sk); -if (asoc) -sctp_association_put (asoc); +sctp_association_put (asoc); }/*
From: Wang Weidong <[email protected]>
Date: Wed, 11 Dec 2013 16:42:14 +0800
Quoted 6 lines
In
sctp_err_lookup, goto out while the asoc is not NULL, so remove the check NULL. Also, insctp_err_finishwhich called bysctp_v4_errandsctp_v6_err, they pass asoc tosctp_err_finishwhile the asoc is not NULL, so remove the check.Signed-off-by Wang Weidong <[email protected]>
Applied, thanks.