From: Luca Boccassi Date: Sat, 28 Mar 2026 19:47:27 +0000 (+0000) Subject: debug-generator: use unsigned bit shift for breakpoint flags X-Git-Tag: v261-rc1~691^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1929226e7e649b72f3f9acd464eaac771c00945c;p=thirdparty%2Fsystemd.git debug-generator: use unsigned bit shift for breakpoint flags Using signed int literal '1' in left shift can lead to undefined behavior if the shift amount causes overflow of a signed int. Use UINT32_C(1) since the result is stored in a uint32_t variable. CID#1568482 Follow-up for e9f781a5a4721d3e58798b37e30bb4dcdbe54c02 --- diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c index 878e1152328..e3b7768fbc8 100644 --- a/src/debug-generator/debug-generator.c +++ b/src/debug-generator/debug-generator.c @@ -101,7 +101,7 @@ static int parse_breakpoint_from_string(const char *s, uint32_t *ret_breakpoints FOREACH_ELEMENT(i, breakpoint_info_table) if (FLAGS_SET(i->validity, BREAKPOINT_DEFAULT) && breakpoint_applies(i, INT_MAX)) { - breakpoints |= 1 << i->type; + breakpoints |= UINT32_C(1) << i->type; found_default = true; break; } @@ -127,7 +127,7 @@ static int parse_breakpoint_from_string(const char *s, uint32_t *ret_breakpoints } if (breakpoint_applies(&breakpoint_info_table[tt], LOG_WARNING)) - breakpoints |= 1 << tt; + breakpoints |= UINT32_C(1) << tt; } *ret_breakpoints = breakpoints;