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=X51PSDuT; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 650B75A0281 for ; Mon, 26 May 2025 16:21:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748269293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zVxYgn1Ocg9wglasm1FFZWoL48MFV8eXUFkYldJwGYk=; b=X51PSDuTxW0Q8JoREWXvhNqZwY2gdRmRwaAiqDl5ZoeeJWEBgM0n5wstkqfzQIlZY0iVYJ JzvpM39vqO3bbeVPX4YYbTZ4T5zA7TKaTT2GZPCah0sRW/xLFAS+O1kTQo/Ej2Y0ZPDEWo 0BBg9pUtzqLJf4GBRk4/rJ7vq9u6EeQ= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-63-MeHpSpbDN9m2MLoHLd9f6A-1; Mon, 26 May 2025 10:21:32 -0400 X-MC-Unique: MeHpSpbDN9m2MLoHLd9f6A-1 X-Mimecast-MFC-AGG-ID: MeHpSpbDN9m2MLoHLd9f6A_1748269291 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-43eea5a5d80so14673025e9.1 for ; Mon, 26 May 2025 07:21:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748269291; x=1748874091; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=zVxYgn1Ocg9wglasm1FFZWoL48MFV8eXUFkYldJwGYk=; b=jPvDMMRtN/mQ2qHRrKinxUKiWnHBcWGNKAARsV2Z3bb+5eOsQ7XgyzOjHqyTXwEPvb yerW5As4IZn2ca/LOQZCOB1lP3Af+Njl8mAfGmRAUixWSh69jBC+ilR5WWi1U/by0uyS eDeZSaqfgk1+5YktWj7ion1UMbrkZqKYQTvT6bUNJtFe3yJjMSfXZh56Q5vzeCYpGjmI UtzAJPlAZ6MpOxrC44JuyKHLCszZBwbGMwJHhHwRCnTES+O6zdAK2N26vjFpzOnOBWW6 SdOws7Wfa6lxr5U8mLIJrrt5Ko4BpIpBn8aNg9AZ6IdoZXJGY59vTF6Vn78Z70WodlBW FjdQ== X-Gm-Message-State: AOJu0Yz9iDzbHMcj5jhb89JiF3qhVxZ9kxtfh6Iqeuw0X/MdDwC5DQOc BbOq0h4SckVPJiDJ+yxrarF4tv0vOXA9+tHyyvz1ULJpjFrXObC6mcCZXbdNpImw29MQ5DeDYd2 bmzNO4X0qLqeXHH4mQOTeoHAPDAvdQqbNF+B+GQWbIh2tMHse3PT0xQ8tD+Z3CAEFOCOH6kH5fJ eb2AOMlDIoFNwbT+7lEt1yUTF27lzy8/ypPun9 X-Gm-Gg: ASbGncurQx2L6vVRze+ViD+/MzYF3SzECDItajgeFM/Leto+NrnxrgAnlXDsMz4Lq0s XgwWldz8CSIxSlKgc/scN4c4yT2F2dEMHucg6HObR2TIOMJw8rFngi5pzrsJqv3Fyc2x5wI88b9 Ym2QawLinq4Y/OyK5LBW/OtfuZbkBs6R/HpT+NqVNE9Q27IVylpTmxFkSICrAYP3TeqVWZf+OKV dtblz7IxScSEAYIOJctbmYrFlmeDvvq9gzqkMFrtnBpbQRFphbRweYJa1yXq7K9ea/ezFEBhBRY 0qAYsBngj4u5adFJtffgA8ZKC0fN1I0XEv1AntN7 X-Received: by 2002:a05:600c:4fd1:b0:43c:eeee:b70a with SMTP id 5b1f17b1804b1-44c9493e68dmr67318475e9.22.1748269290745; Mon, 26 May 2025 07:21:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHCuwlt28ecHD9DdbkhDqh52gXeAHV6sdIrSh0lCaj8CCgI+R/RQqy1MHChFjZGGxIv/qj8g== X-Received: by 2002:a05:600c:4fd1:b0:43c:eeee:b70a with SMTP id 5b1f17b1804b1-44c9493e68dmr67318255e9.22.1748269290259; Mon, 26 May 2025 07:21:30 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-447f6b29633sm251201705e9.8.2025.05.26.07.21.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 May 2025 07:21:29 -0700 (PDT) Date: Mon, 26 May 2025 16:21:28 +0200 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH v5 25/29] ndp: use iov_tail rather than pool Message-ID: <20250526162128.074e4810@elisabeth> In-Reply-To: <20250417165136.2688884-26-lvivier@redhat.com> References: <20250417165136.2688884-1-lvivier@redhat.com> <20250417165136.2688884-26-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Lwr0JkBA_ygAvfHd6LyhEH-RidKJqNheTXZAK4uQNmc_1748269291 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: XTHX4APLQ7IJKUZL5QMJNIKTQCAU7O6A X-Message-ID-Hash: XTHX4APLQ7IJKUZL5QMJNIKTQCAU7O6A X-MailFrom: sbrivio@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 CC: passt-dev@passt.top 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: On Thu, 17 Apr 2025 18:51:32 +0200 Laurent Vivier wrote: > Signed-off-by: Laurent Vivier > --- > ndp.c | 16 ++++++++-------- > ndp.h | 4 ++-- > tap.c | 10 +++------- > 3 files changed, 13 insertions(+), 17 deletions(-) > > diff --git a/ndp.c b/ndp.c > index b09a1a133f56..95cb1d983f12 100644 > --- a/ndp.c > +++ b/ndp.c > @@ -336,13 +336,17 @@ static void ndp_ra(const struct ctx *c, const struct in6_addr *dst) > * @c: Execution context > * @ih: ICMPv6 header > * @saddr: Source IPv6 address > - * @p: Packet pool > + * @data: Single packet with ICMPv6 header > * > * Return: 0 if not handled here, 1 if handled, -1 on failure > */ > -int ndp(const struct ctx *c, const struct icmp6hdr *ih, > - const struct in6_addr *saddr, const struct pool *p) > +int ndp(const struct ctx *c, const struct in6_addr *saddr, > + struct iov_tail *data) > { > + struct icmp6hdr ihc; > + const struct icmp6hdr *ih; Nit: these two should be swapped. Usual comment about the 'c' (here it's particularly unclear, I think, but also the 'nsc' usage below is rather obscure). > + > + ih = IOV_PEEK_HEADER(data, ihc); > if (ih->icmp6_type < RS || ih->icmp6_type > NA) > return 0; I had started splitting warnings reported by Coverity per patch but actually it's all about cases like this one, so here it is as a single comment: /home/sbrivio/passt/ndp.c:351:2: Type: Dereference null return value (NULL_RETURNS) /home/sbrivio/passt/ndp.c:350:2: Call to null-returning function 1. returned_null: "iov_peek_header_" returns "NULL" (checked 18 out of 20 times). /home/sbrivio/passt/iov.c:315:2: Call to null-returning function 1.1. path: Condition "p", taking false branch. /home/sbrivio/passt/iov.c:319:2: 1.2. path: Condition "l != len", taking true branch. /home/sbrivio/passt/iov.c:320:3: 1.3. return_null: Explicitly returning null. /home/sbrivio/passt/ndp.c:350:2: 2. var_assigned: Assigning: "ih" = "NULL" return value from "iov_peek_header_". /home/sbrivio/passt/ndp.c:351:2: 3. dereference: Dereferencing "ih", which is known to be "NULL". /home/sbrivio/passt/dhcp.c:320:2: Examples where return value was checked for null 4. example_assign: Example 1: Assigning: "iph" = return value from "iov_peek_header_(data, &iphc, 20UL, 4UL)". /home/sbrivio/passt/dhcp.c:321:2: 5. example_checked: Example 1 (cont.): "iph" has its value checked in "iph". /home/sbrivio/passt/dhcpv6.c:296:2: Examples where return value was checked for null 6. example_checked: Example 2: "iov_peek_header_(data, &oc, 4UL, 1UL)" has its value checked in "o = (struct opt_hdr *)iov_peek_header_(data, &oc, 4UL, 1UL)". /home/sbrivio/passt/iov.c:343:2: Examples where return value was checked for null 7. example_assign: Example 3: Assigning: "p" = return value from "iov_peek_header_(tail, v, len, align)". /home/sbrivio/passt/iov.c:345:2: 8. example_checked: Example 3 (cont.): "p" has its value checked in "p". /home/sbrivio/passt/ip.c:50:2: Examples where return value was checked for null 9. example_checked: Example 4: "iov_peek_header_(data, &oc, 2UL, 1UL)" has its value checked in "o = (struct ipv6_opt_hdr *)iov_peek_header_(data, &oc, 2UL, 1UL)". /home/sbrivio/passt/tap.c:776:3: Examples where return value was checked for null 10. example_assign: Example 5: Assigning: "uh" = return value from "iov_peek_header_(&data, &uhc, 8UL, 2UL)". /home/sbrivio/passt/tap.c:777:3: 11. example_checked: Example 5 (cont.): "uh" has its value checked in "uh". ...and I think I would actually be reasonable to add a check on 'ih'. Same for (with this whole series applied): /home/sbrivio/passt/dhcpv6.c:349:5: Type: Dereference null return value (NULL_RETURNS) /home/sbrivio/passt/tap.c:1006:4: Type: Dereference null return value (NULL_RETURNS) /home/sbrivio/passt/tap.c:1015:4: Type: Dereference null return value (NULL_RETURNS) -- Stefano