linux-stable/tools
John Stultz a79b53d0d9 selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior
[ Upstream commit 0763613621 ]

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-05-17 11:48:05 +02:00
..
accounting
arch parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes 2023-12-08 08:46:12 +01:00
bootconfig bootconfig: Fix testcase to increase max node 2023-04-05 11:23:34 +02:00
bpf bpftool: Silence build warning about calloc() 2024-03-26 18:21:49 -04:00
build tools build: Switch to new openssl API for test-libcrypto 2022-08-25 11:38:01 +02:00
cgroup
debugging
edid
firewire
firmware
gpio tools: gpio: fix debounce_period_us output of lsgpio 2023-06-21 15:45:35 +02:00
hv vmbus_testing: fix wrong python syntax for integer value comparison 2023-09-19 12:20:05 +02:00
iio tools: iio: replace seekdir() in iio_generic_buffer 2024-04-13 12:59:51 +02:00
include objtool: Add asm version of STACK_FRAME_NON_STANDARD 2024-04-13 12:59:39 +02:00
io_uring
kvm/kvm_stat tools/kvm_stat: fix display of error when multiple processes are found 2022-08-11 13:06:45 +02:00
laptop
leds
lib libperf evlist: Avoid out-of-bounds access 2024-04-13 12:59:48 +02:00
memory-model
objtool objtool/x86: add missing embedded_insn check 2023-11-08 17:30:47 +01:00
pci
pcmcia
perf perf stat: Avoid metric-only segv 2024-03-26 18:21:57 -04:00
power tools/power turbostat: Fix Bzy_MHz documentation typo 2024-05-17 11:48:04 +02:00
scripts
spi
testing selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior 2024-05-17 11:48:05 +02:00
thermal/tmon tools/thermal: Fix possible path truncations 2022-08-21 15:16:12 +02:00
time
usb
virtio tools/virtio: fix the vringh test for virtio ring changes 2023-02-22 12:55:53 +01:00
vm tools/vm/slabinfo-gnuplot: use "grep -E" instead of "egrep" 2022-12-08 11:23:57 +01:00
wmi
Makefile