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


Groups > linux.kernel > #1703448

Re: [PATCH v2] bitops: Avoid integer overflow in GENMASK(_ULL)

From Andrew Morton <akpm@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] bitops: Avoid integer overflow in GENMASK(_ULL)
Date 2017-08-03 23:50 +0200
Message-ID <uawad-5UG-13@gated-at.bofh.it> (permalink)
References <uavQR-5Ka-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu,  3 Aug 2017 14:20:20 -0700 Matthias Kaehlcke <mka@chromium.org> wrote:

> GENMASK(_ULL) performs a left-shift of ~0UL(L), which technically
> results in an integer overflow. clang raises a warning if the overflow
> occurs in a preprocessor expression.

That's just irritaing.

> Clear the low-order bits through
> a substraction instead of the left-shift to avoid the overflow.

There's no change in .text size for a few files I tested so guess we
can live with it.

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


Thread

[PATCH v2] bitops: Avoid integer overflow in GENMASK(_ULL) Matthias Kaehlcke <mka@chromium.org> - 2017-08-03 23:30 +0200
  Re: [PATCH v2] bitops: Avoid integer overflow in GENMASK(_ULL) Andrew Morton <akpm@linux-foundation.org> - 2017-08-03 23:50 +0200

csiph-web