Commit 7f4e446da7 for frr
commit 7f4e446da719cc7978a2f004a961ebbd879da4a3
Author: Dave Seddon <dave.seddon.ca@gmail.com>
Date: Sat Nov 28 22:10:26 2026 -0800
lib, pimd: use unsigned constants for bit 31
TIMEFMT_DASHES and PIM_MASK_STATE_REFRESH were written as (1 << 31),
which shifts into the sign bit of an int and is undefined behaviour.
Both are only used as 32-bit flag masks, so nothing changes with the
compilers in use.
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
diff --git a/lib/monotime.h b/lib/monotime.h
index 8b5f1e8c25..dac471ee92 100644
--- a/lib/monotime.h
+++ b/lib/monotime.h
@@ -254,7 +254,7 @@ enum {
/* 'd' - print as decimal number of seconds */
TIMEFMT_DECIMAL = (1 << 27),
/* 'mx'/'hx' - replace zero value with "--:--" or "--:--:--" */
- TIMEFMT_DASHES = (1 << 31),
+ TIMEFMT_DASHES = (1U << 31),
/* helpers for reference */
TIMEFMT_TIMER_DEADLINE =
diff --git a/pimd/pimd.h b/pimd/pimd.h
index a7eff6bd82..2a92244205 100644
--- a/pimd/pimd.h
+++ b/pimd/pimd.h
@@ -114,7 +114,7 @@
#define PIM_MASK_MLAG (1 << 28)
#define PIM_MASK_AUTORP (1 << 29)
#define PIM_MASK_GRAFT (1 << 30)
-#define PIM_MASK_STATE_REFRESH (1 << 31)
+#define PIM_MASK_STATE_REFRESH (1U << 31)
/* Remember 32 bits!!! */
/* PIM error codes */