diff mbox series

[net-next,3/3] sctp: remove unnecessary NULL checks in sctp_enqueue_event()

Message ID 20221019180735.161388-3-aleksei.kodanev@bell-sw.com (mailing list archive)
State Accepted
Commit 377eb9aab084bf298eed9b55ba173dad36fdf7f2
Delegated to: Netdev Maintainers
Headers show
Series [net-next,1/3] sctp: remove unnecessary NULL check in sctp_association_init() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter warning Series does not have a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/cc_maintainers warning 7 maintainers not CCed: kuba@kernel.org vyasevich@gmail.com nhorman@tuxdriver.com davem@davemloft.net marcelo.leitner@gmail.com edumazet@google.com pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Alexey Kodanev Oct. 19, 2022, 6:07 p.m. UTC
After commit 178ca044aa60 ("sctp: Make sctp_enqueue_event tak an
skb list."), skb_list cannot be NULL.

Detected using the static analysis tool - Svace.
Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 net/sctp/stream_interleave.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Xin Long Oct. 19, 2022, 9:28 p.m. UTC | #1
On Wed, Oct 19, 2022 at 2:36 PM Alexey Kodanev
<aleksei.kodanev@bell-sw.com> wrote:
>
> After commit 178ca044aa60 ("sctp: Make sctp_enqueue_event tak an
> skb list."), skb_list cannot be NULL.
>
> Detected using the static analysis tool - Svace.
> Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
> ---
>  net/sctp/stream_interleave.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/net/sctp/stream_interleave.c b/net/sctp/stream_interleave.c
> index bb22b71df7a3..94727feb07b3 100644
> --- a/net/sctp/stream_interleave.c
> +++ b/net/sctp/stream_interleave.c
> @@ -490,11 +490,8 @@ static int sctp_enqueue_event(struct sctp_ulpq *ulpq,
>         if (!sctp_ulpevent_is_enabled(event, ulpq->asoc->subscribe))
>                 goto out_free;
>
> -       if (skb_list)
> -               skb_queue_splice_tail_init(skb_list,
> -                                          &sk->sk_receive_queue);
> -       else
> -               __skb_queue_tail(&sk->sk_receive_queue, skb);
> +       skb_queue_splice_tail_init(skb_list,
> +                                  &sk->sk_receive_queue);
>
>         if (!sp->data_ready_signalled) {
>                 sp->data_ready_signalled = 1;
> @@ -504,10 +501,7 @@ static int sctp_enqueue_event(struct sctp_ulpq *ulpq,
>         return 1;
>
>  out_free:
> -       if (skb_list)
> -               sctp_queue_purge_ulpevents(skb_list);
> -       else
> -               sctp_ulpevent_free(event);
> +       sctp_queue_purge_ulpevents(skb_list);
>
>         return 0;
>  }
> --
> 2.25.1
>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
diff mbox series

Patch

diff --git a/net/sctp/stream_interleave.c b/net/sctp/stream_interleave.c
index bb22b71df7a3..94727feb07b3 100644
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -490,11 +490,8 @@  static int sctp_enqueue_event(struct sctp_ulpq *ulpq,
 	if (!sctp_ulpevent_is_enabled(event, ulpq->asoc->subscribe))
 		goto out_free;
 
-	if (skb_list)
-		skb_queue_splice_tail_init(skb_list,
-					   &sk->sk_receive_queue);
-	else
-		__skb_queue_tail(&sk->sk_receive_queue, skb);
+	skb_queue_splice_tail_init(skb_list,
+				   &sk->sk_receive_queue);
 
 	if (!sp->data_ready_signalled) {
 		sp->data_ready_signalled = 1;
@@ -504,10 +501,7 @@  static int sctp_enqueue_event(struct sctp_ulpq *ulpq,
 	return 1;
 
 out_free:
-	if (skb_list)
-		sctp_queue_purge_ulpevents(skb_list);
-	else
-		sctp_ulpevent_free(event);
+	sctp_queue_purge_ulpevents(skb_list);
 
 	return 0;
 }