Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jan 2025 12:27:27 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5cf27105df1e - stable/13 - queue: Fix STAILQ_SWAP
Message-ID:  <202501171227.50HCRRK6053054@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=5cf27105df1ec5e7e5c7627de978fbcb8e0671dd

commit 5cf27105df1ec5e7e5c7627de978fbcb8e0671dd
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-12-17 00:12:11 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-01-17 12:24:54 +0000

    queue: Fix STAILQ_SWAP
    
    The debug assertions added in commit 34740937f7a4 do not hold for a
    window in STAILQ_SWAP, so check whether the queues are empty directly.
    
    Reported by:    ler
    Fixes:          34740937f7a4 ("queue: New debug macros for STAILQ")
    
    (cherry picked from commit da2c88dfcf4f425e6e0a58d6df3a7c8e88d8df92)
---
 sys/sys/queue.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/sys/queue.h b/sys/sys/queue.h
index 4e0ba068c520..0b1e1f9fba55 100644
--- a/sys/sys/queue.h
+++ b/sys/sys/queue.h
@@ -474,9 +474,9 @@ struct {								\
 	(head1)->stqh_last = (head2)->stqh_last;			\
 	STAILQ_FIRST(head2) = swap_first;				\
 	(head2)->stqh_last = swap_last;					\
-	if (STAILQ_EMPTY(head1))					\
+	if (STAILQ_FIRST(head1) == NULL)				\
 		(head1)->stqh_last = &STAILQ_FIRST(head1);		\
-	if (STAILQ_EMPTY(head2))					\
+	if (STAILQ_FIRST(head2) == NULL)				\
 		(head2)->stqh_last = &STAILQ_FIRST(head2);		\
 } while (0)
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501171227.50HCRRK6053054>