From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4CB94469F8 for ; Thu, 19 Jun 2025 09:11:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BCF442E63; Thu, 19 Jun 2025 09:11:52 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id B86E142E49 for ; Thu, 19 Jun 2025 09:11:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750317110; 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=ZdafeB+rAu96J/oAy7xHoa9QDY84Xd1OZqgPQGA366Q=; b=BgZDf6B6Q14UPsBLlBfZc83Ybhzu2jqCEAt+J41adMBNSowhboGpUKo1yg7qMXw4QC7HAs h+euF6X6O6xCMglFo2FFGTRyYbX7iAbPNmWm2g02sZ9fpnnkc/5+KjSgwujyhFUDvSA/+m ht96ja2UCgMYMcb+hpiwVMpo9rR+D5o= Received: from mx-prod-mc-05.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-34-zXs3ggBGNp23DW2uRqL86w-1; Thu, 19 Jun 2025 03:11:46 -0400 X-MC-Unique: zXs3ggBGNp23DW2uRqL86w-1 X-Mimecast-MFC-AGG-ID: zXs3ggBGNp23DW2uRqL86w_1750317105 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7EE3319560A2; Thu, 19 Jun 2025 07:11:45 +0000 (UTC) Received: from dmarchan.lan (unknown [10.44.33.8]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B5A791956094; Thu, 19 Jun 2025 07:11:43 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Tyler Retzlaff , Neil Horman Subject: [PATCH 07/10] tailq: fix cast macro for null pointer Date: Thu, 19 Jun 2025 09:10:33 +0200 Message-ID: <20250619071037.37325-8-david.marchand@redhat.com> In-Reply-To: <20250619071037.37325-1-david.marchand@redhat.com> References: <20250619071037.37325-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ES8gM0rEzqaFKxo6mMb-Q4wbHkseWeK_tEBkoYSDv0A_1750317105 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Doing arithmetics with the NULL pointer is undefined. Caught by UBSan: ../app/test/test_tailq.c:111:9: runtime error: member access within null pointer of type 'struct rte_tailq_head' Fixes: f6b4f6c9c123 ("tailq: use a single cast macro") Cc: stable@dpdk.org Signed-off-by: David Marchand --- lib/eal/include/rte_tailq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/include/rte_tailq.h b/lib/eal/include/rte_tailq.h index 89f7ef2134..c23df77d96 100644 --- a/lib/eal/include/rte_tailq.h +++ b/lib/eal/include/rte_tailq.h @@ -54,7 +54,7 @@ struct rte_tailq_elem { * Return the first tailq entry cast to the right struct. */ #define RTE_TAILQ_CAST(tailq_entry, struct_name) \ - (struct struct_name *)&(tailq_entry)->tailq_head + (tailq_entry == NULL ? NULL : (struct struct_name *)&(tailq_entry)->tailq_head) /** * Utility macro to make looking up a tailqueue for a particular struct easier. -- 2.49.0