* [bug report] sctp: remove the useless check in sctp_renege_events
@ 2018-02-15 8:11 Dan Carpenter
2018-02-15 9:51 ` Xin Long
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-02-15 8:11 UTC (permalink / raw)
To: linux-sctp
Hello Xin Long,
This is a semi-automatic email about new static checker warnings.
The patch fb23403536ea: "sctp: remove the useless check in
sctp_renege_events" from Feb 12, 2018, leads to the following Smatch
complaint:
net/sctp/stream_interleave.c:970 sctp_renege_events()
warn: variable dereferenced before check 'chunk' (see line 957)
net/sctp/stream_interleave.c
956
957 needed = ntohs(chunk->chunk_hdr->length) -
^^^^^^^^^^^^^^^^
We removed the check for "chunk"
958 sizeof(struct sctp_idata_chunk);
959
960 if (skb_queue_empty(&asoc->base.sk->sk_receive_queue)) {
961 freed = sctp_ulpq_renege_list(ulpq, &ulpq->lobby, needed);
962 if (freed < needed)
963 freed += sctp_ulpq_renege_list(ulpq, &ulpq->reasm,
964 needed);
965 if (freed < needed)
966 freed += sctp_ulpq_renege_list(ulpq, &ulpq->reasm_uo,
967 needed);
968 }
969
970 if (chunk && freed >= needed)
^^^^^
so we should probably remove it here.
971 if (sctp_ulpevent_idata(ulpq, chunk, gfp) <= 0)
972 sctp_intl_start_pd(ulpq, gfp);
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] sctp: remove the useless check in sctp_renege_events
2018-02-15 8:11 [bug report] sctp: remove the useless check in sctp_renege_events Dan Carpenter
@ 2018-02-15 9:51 ` Xin Long
0 siblings, 0 replies; 2+ messages in thread
From: Xin Long @ 2018-02-15 9:51 UTC (permalink / raw)
To: linux-sctp
On Thu, Feb 15, 2018 at 4:11 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Hello Xin Long,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch fb23403536ea: "sctp: remove the useless check in
> sctp_renege_events" from Feb 12, 2018, leads to the following Smatch
> complaint:
>
> net/sctp/stream_interleave.c:970 sctp_renege_events()
> warn: variable dereferenced before check 'chunk' (see line 957)
>
> net/sctp/stream_interleave.c
> 956
> 957 needed = ntohs(chunk->chunk_hdr->length) -
> ^^^^^^^^^^^^^^^^
> We removed the check for "chunk"
>
> 958 sizeof(struct sctp_idata_chunk);
> 959
> 960 if (skb_queue_empty(&asoc->base.sk->sk_receive_queue)) {
> 961 freed = sctp_ulpq_renege_list(ulpq, &ulpq->lobby, needed);
> 962 if (freed < needed)
> 963 freed += sctp_ulpq_renege_list(ulpq, &ulpq->reasm,
> 964 needed);
> 965 if (freed < needed)
> 966 freed += sctp_ulpq_renege_list(ulpq, &ulpq->reasm_uo,
> 967 needed);
> 968 }
> 969
> 970 if (chunk && freed >= needed)
> ^^^^^
> so we should probably remove it here.
yes, you're right. I should have removed it in that patch.
I will submit a new one for it soon, thanks for your report.
>
> 971 if (sctp_ulpevent_idata(ulpq, chunk, gfp) <= 0)
> 972 sctp_intl_start_pd(ulpq, gfp);
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-15 9:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-15 8:11 [bug report] sctp: remove the useless check in sctp_renege_events Dan Carpenter
2018-02-15 9:51 ` Xin Long
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.