On 4/9/24 14:22, John Stultz wrote:
So, 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
will trip 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,
         ~~~~^
...

So fix our use of shifting negative values in the valid-adjtimex
test case to use multiply by (1<<16) to avoid this.

The patch also aligns the values a bit to make it look nicer.

Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Stephen Boyd <sb...@kernel.org>
Cc: Anna-Maria Behnsen <anna-ma...@linutronix.de>
Cc: Frederic Weisbecker <frede...@kernel.org>
Cc: Shuah Khan <sh...@kernel.org>
Cc: Nathan Chancellor <nat...@kernel.org>
Cc: Nick Desaulniers <ndesaulni...@google.com>
Cc: Lee Jones <jones...@google.com>
Cc: Muhammad Usama Anjum <usama.an...@collabora.com>
Cc: linux-kselftest@vger.kernel.org
Reported-by: Lee Jones <jones...@google.com>
Reported-by: Muhammad Usama Anjum <usama.an...@collabora.com>
Link: 
https://lore.kernel.org/lkml/0c6d4f0d-2064-4444-986b-1d1ed7821...@collabora.com/
Signed-off-by: John Stultz <jstu...@google.com>
---

Applied to linux-kselftest next for Linux6.10-rc1.

thanks,
-- Shuah


Reply via email to