Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1703316

Re: [PATCH] arm64: avoid overflow in VA_START and PAGE_OFFSET

From Nick Desaulniers <ndesaulniers@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH] arm64: avoid overflow in VA_START and PAGE_OFFSET
Date 2017-08-03 20:00 +0200
Message-ID <uaszE-3m4-19@gated-at.bofh.it> (permalink)
References <uarWX-37e-43@gated-at.bofh.it> <uarWX-37e-41@gated-at.bofh.it> <uas6C-3bf-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> 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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] arm64: avoid overflow in VA_START and PAGE_OFFSET Nick Desaulniers <ndesaulniers@google.com> - 2017-08-03 19:20 +0200
  Re: [PATCH] arm64: avoid overflow in VA_START and PAGE_OFFSET Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-08-03 19:30 +0200
    Re: [PATCH] arm64: avoid overflow in VA_START and PAGE_OFFSET Nick Desaulniers <ndesaulniers@google.com> - 2017-08-03 20:00 +0200
      [PATCH v2] arm64: avoid overflow in VA_START and PAGE_OFFSET Nick Desaulniers <ndesaulniers@google.com> - 2017-08-03 20:10 +0200

csiph-web