aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-09-28 14:33:32 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-09-29 12:22:32 +0200
commit1ae95f33cc8f276ee1f4db019d9077a606283763 (patch)
tree95171302f3477a6a6f74d4e965e294d90b608281 /tcp.c
parent8f6be016aeacabd9a83d04b123e6bda898196ea2 (diff)
downloadpasst-1ae95f33cc8f276ee1f4db019d9077a606283763.tar
passt-1ae95f33cc8f276ee1f4db019d9077a606283763.tar.gz
passt-1ae95f33cc8f276ee1f4db019d9077a606283763.tar.bz2
passt-1ae95f33cc8f276ee1f4db019d9077a606283763.tar.lz
passt-1ae95f33cc8f276ee1f4db019d9077a606283763.tar.xz
passt-1ae95f33cc8f276ee1f4db019d9077a606283763.tar.zst
passt-1ae95f33cc8f276ee1f4db019d9077a606283763.zip
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>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tcp.c b/tcp.c
index b694792..8ec991c 100644
--- a/tcp.c
+++ b/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;