From b4a9d19e4ec527a7b2d774a1349a6133f7739847 Mon Sep 17 00:00:00 2001
From: Rose <83477269+AtariDreams@users.noreply.github.com>
Date: Tue, 2 Jan 2024 10:13:27 -0500
Subject: [PATCH] basic: fix overflow detection in sigbus_pop

The current check checks for n_sigbus_queue
being greater than or equal to SIGBUS_QUEUE_MAX,
when it should be just greater than as
n_sigbus_queue being SIGBUS_QUEUE_MAX indicates
that the queue is full, but not overflowed.

Conflict:adapt context
Reference:https://github.com/systemd/systemd/commit/b4a9d19e4ec527a7b2d774a1349a6133f7739847

---
 src/basic/sigbus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/basic/sigbus.c b/src/basic/sigbus.c
index 7e5a493f6b..47ab0b81d8 100644
--- a/src/basic/sigbus.c
+++ b/src/basic/sigbus.c
@@ -40,14 +40,14 @@ static void sigbus_push(void *addr) {
                 }
 
         /* If we can't, make sure the queue size is out of bounds, to
-         * mark it as overflow */
+         * mark it as overflowed */
         for (;;) {
                 unsigned c;
 
                 __sync_synchronize();
                 c = n_sigbus_queue;
 
-                if (c > SIGBUS_QUEUE_MAX) /* already overflow */
+                if (c > SIGBUS_QUEUE_MAX) /* already overflowed */
                         return;
 
                 if (__sync_bool_compare_and_swap(&n_sigbus_queue, c, c + SIGBUS_QUEUE_MAX))
@@ -70,7 +70,7 @@ int sigbus_pop(void **ret) {
                 if (_likely_(c == 0))
                         return 0;
 
-                if (_unlikely_(c >= SIGBUS_QUEUE_MAX))
+                if (_unlikely_(c > SIGBUS_QUEUE_MAX))
                         return -EOVERFLOW;
 
                 for (u = 0; u < SIGBUS_QUEUE_MAX; u++) {
-- 
2.39.1

