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


Groups > linux.kernel > #1227531

Re: [PATCH] kernel.h: make abs() work with 64-bit types

From John Stultz <john.stultz@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] kernel.h: make abs() work with 64-bit types
Date 2015-09-18 05:20 +0200
Message-ID <q9Unn-782-5@gated-at.bofh.it> (permalink)
References <q8MUV-6nq-5@gated-at.bofh.it> <q8MUW-6nq-13@gated-at.bofh.it> <q8QYy-3JQ-5@gated-at.bofh.it> <q98iL-4c5-27@gated-at.bofh.it> <q9ktA-4U2-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Sep 16, 2015 at 5:57 AM, Michal Nazarewicz <mina86@mina86.com> wrote:
> For 64-bit arguments, abs macro casts it to an int which leads to lost
> precision and may cause incorrect results.  To deal with 64-bit types
> abs64 macro has been introduced but still there are places where abs
> macro is used incorrectly.
>
> To deal with the problem, expand abs macro such that it operates on s64
> type when dealing with 64-bit types while still returning long when
> dealing with smaller types.
>
> Signed-off-by: Michal Nazarewicz <mina86@mina86.com>

Sorry this is a little late, but I did run this patch through my tests
on a 32bit system (against 4.2, since my localized fix has already
landed in Linus' head) to make sure it resolved the bug I saw and it
did.

So,
Tested-by: John Stultz <john.stultz@linaro.org>

thanks!
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[RFC][PATCH 5/5] abs(): Provide build error on passing 64bit value to abs() John Stultz <john.stultz@linaro.org> - 2015-09-15 03:10 +0200
  Re: [RFC][PATCH 5/5] abs(): Provide build error on passing 64bit  value to abs() Ingo Molnar <mingo@kernel.org> - 2015-09-15 07:30 +0200
    Re: [RFC][PATCH 5/5] abs(): Provide build error on passing 64bit  value to abs() Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-16 02:00 +0200
      [PATCH] kernel.h: make abs() work with 64-bit types Michal Nazarewicz <mina86@mina86.com> - 2015-09-16 15:00 +0200
        Re: [PATCH] kernel.h: make abs() work with 64-bit types John Stultz <john.stultz@linaro.org> - 2015-09-18 05:20 +0200

csiph-web