cppcheck: Suppress NULL pointer warning in tcp_sock_consume()
Recent versions of cppcheck give a warning due to the NULL buffer passed to recv() in tcp_sock_consume(). Since this apparently works, I assume it's actually valid, but cppcheck doesn't know that recv() can take a NULL buffer. So, use a suppression to get rid of the error. Also add an unmatchedSuppression suppression since only some cppcheck versions complain about this. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
8f6be016ae
commit
1ae95f33cc
1 changed files with 1 additions and 0 deletions
1
tcp.c
1
tcp.c
|
@ -2280,6 +2280,7 @@ static int tcp_sock_consume(struct tcp_conn *conn, uint32_t ack_seq)
|
|||
if (SEQ_LE(ack_seq, conn->seq_ack_from_tap))
|
||||
return 0;
|
||||
|
||||
/* cppcheck-suppress [nullPointer, unmatchedSuppression] */
|
||||
if (recv(conn->sock, NULL, ack_seq - conn->seq_ack_from_tap,
|
||||
MSG_DONTWAIT | MSG_TRUNC) < 0)
|
||||
return -errno;
|
||||
|
|
Loading…
Reference in a new issue