[PATCH] arm64: avoid overflow in VA_START and PAGE_OFFSET

From
Nick Desaulniers <ndesaulniers@google.com>
Date
2017-08-03 17:53:14
Also in
lkml
Reply to
Ard Biesheuvel, 2017-08-03
Would

#define VA_START (UL(0xffffffffffffffff) - (1 << VA_BITS) + 1)

also work?
I think you'd have to wrap the 1 in a UL(), ex:

#define VA_START (UL(0xffffffffffffffff) - (UL(1) << VA_BITS) + 1)

Otherwise IIUC a integral literal (`1`) is treated as an int, which on
arm64 is LP64 making it 32b, where most configs set VA_BITS
to larger than 32b.  Shifting by more than the width is undefined
behavior. And without it, I get compile errors.

I'll send v2 with your suggestion, thanks.
-- 
Thanks,
~Nick Desaulniers
Thread (13 messages) 13 messages, 5 authors, last reply 2017-08-04
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help