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 <[email protected]>
Cc: Stephen Boyd <[email protected]>
Cc: Anna-Maria Behnsen <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Muhammad Usama Anjum <[email protected]>
Cc: [email protected]
Reported-by: Lee Jones <[email protected]>
Reported-by: Muhammad Usama Anjum <[email protected]>
Link: 
https://lore.kernel.org/lkml/[email protected]/
Signed-off-by: John Stultz <[email protected]>
---

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

thanks,
-- Shuah


Reply via email to