Recent versions of cppcheck give a warning due to the NULL buffer passed to recv() in tcp_sock_consume(). In fact this is safe, because we're using MSG_TRUNC which means the kernel will ignore the buffer. 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(a)gibson.dropbear.id.au> --- tcp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tcp.c b/tcp.c index b694792..d223125 100644 --- a/tcp.c +++ b/tcp.c @@ -2280,6 +2280,10 @@ 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 doesn't know about MSG_TRUNC which means the + * kernel doesn't care that the buffer is NULL + */ + /* cppcheck-suppress [nullPointer, unmatchedSuppression] */ if (recv(conn->sock, NULL, ack_seq - conn->seq_ack_from_tap, MSG_DONTWAIT | MSG_TRUNC) < 0) return -errno; -- 2.37.3