From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=d/6iBJm3; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 6E9315A0272 for ; Sun, 31 May 2026 22:20:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780258832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=orA1ybOTN/0d6ueh6wB9kGtKsp6yoQHoXQIQ0ZPwd7k=; b=d/6iBJm3/KbJvaHT8cR5YKtwIVRNPafe7vj6CN3OhNAiFUbgIkweU6VCI6fdXueVomgLfn UJOs6OW4oI1Qgf7IG9y9GAP12jKoDo7U+JA1NV5IYV7IUxITLeRLU7Mul7okq4DS2cXNbm AEDllkypXspcy2j+239yapwMQH7uqp4= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-400-3xbe3bHxOfqx5dlf9erZIg-1; Sun, 31 May 2026 16:20:30 -0400 X-MC-Unique: 3xbe3bHxOfqx5dlf9erZIg-1 X-Mimecast-MFC-AGG-ID: 3xbe3bHxOfqx5dlf9erZIg_1780258830 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8893D19560AA; Sun, 31 May 2026 20:20:29 +0000 (UTC) Received: from jmaloy-thinkpadp16vgen1.rmtcaqc.csb (unknown [10.22.88.48]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4AF8F1956053; Sun, 31 May 2026 20:20:28 +0000 (UTC) From: Jon Maloy To: sbrivio@redhat.com, david@gibson.dropbear.id.au, jmaloy@redhat.com, passt-dev@passt.top Subject: [PATCH] udp: Provide dummy iov in udp_peek_addr() to avoid Coverity warning Date: Sun, 31 May 2026 16:20:27 -0400 Message-ID: <20260531202027.1721248-1-jmaloy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: trpbJCKjyknCSLgolSpqDzB4st37OwAJC27ukW7FjgA_1780258830 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 6WZGCYBZZ6V54QHPXDIINUDNSXX5UEV2 X-Message-ID-Hash: 6WZGCYBZZ6V54QHPXDIINUDNSXX5UEV2 X-MailFrom: jmaloy@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: udp_peek_addr() initialises struct msghdr without setting msg_iov, leaving it implicitly NULL. Coverity flags this as FORWARD_NULL, believing recvmsg() will dereference the NULL pointer. In practice, msg_iovlen being zero means the kernel never touches msg_iov, so the warning is a false positive. We now provide a one-byte dummy iov to make msg_iov non-NULL, hence suppressing this warning without changing the function's behaviour. Signed-off-by: Jon Maloy --- udp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/udp.c b/udp.c index c28d6ee2..f648cb8b 100644 --- a/udp.c +++ b/udp.c @@ -734,9 +734,16 @@ static int udp_peek_addr(int s, union sockaddr_inany *src, { char sastr[SOCKADDR_STRLEN], dstr[INANY_ADDRSTRLEN]; char cmsg[PKTINFO_SPACE]; + char dummy; + struct iovec iov = { + .iov_base = &dummy, + .iov_len = sizeof(dummy), + }; struct msghdr msg = { .msg_name = src, .msg_namelen = sizeof(*src), + .msg_iov = &iov, + .msg_iovlen = 1, .msg_control = cmsg, .msg_controllen = sizeof(cmsg), }; -- 2.52.0