kernel_samsung_a53x/tools/testing/selftests/timers
John Stultz 55aaa47f87 selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior
[ Upstream commit 076361362122a6d8a4c45f172ced5576b2d4a50d ]

The struct adjtimex freq field takes a signed value who's units are in
shifted (<<16) parts-per-million.

Unfortunately for negative adjustments, the straightforward use of:

  freq = ppm << 16 trips undefined behavior warnings with clang:

valid-adjtimex.c:66:6: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
        -499<<16,
        ~~~~^
valid-adjtimex.c:67:6: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
        -450<<16,
        ~~~~^
..

Fix it by using a multiply by (1 << 16) instead of shifting negative values
in the valid-adjtimex test case. Align the values for better readability.

Reported-by: Lee Jones <joneslee@google.com>
Reported-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: John Stultz <jstultz@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://lore.kernel.org/r/20240409202222.2830476-1-jstultz@google.com
Link: https://lore.kernel.org/lkml/0c6d4f0d-2064-4444-986b-1d1ed782135f@collabora.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 11:32:44 +01:00
..
adjtick.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
alarmtimer-suspend.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
change_skew.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clocksource-switch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
freq-step.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inconsistency-check.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
leap-a-day.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
leapcrash.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mqueue-lat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nanosleep.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nsleep-lat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
posix_timers.c selftests: timers: Fix abs() warning in posix_timers test 2024-11-19 11:32:20 +01:00
raw_skew.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtcpie.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
set-2038.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
set-tai.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
set-timer-lat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
set-tz.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
settings Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
skew_consistency.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
threadtest.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
valid-adjtimex.c selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior 2024-11-19 11:32:44 +01:00