From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752712AbbIRDMZ (ORCPT ); Thu, 17 Sep 2015 23:12:25 -0400 Received: from mail-ig0-f178.google.com ([209.85.213.178]:34194 "EHLO mail-ig0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751854AbbIRDMY (ORCPT ); Thu, 17 Sep 2015 23:12:24 -0400 MIME-Version: 1.0 In-Reply-To: References: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> <1442279124-7309-6-git-send-email-john.stultz@linaro.org> <20150915052202.GB14215@gmail.com> Date: Thu, 17 Sep 2015 20:12:23 -0700 Message-ID: Subject: Re: [PATCH] kernel.h: make abs() work with 64-bit types From: John Stultz To: Michal Nazarewicz Cc: Linus Torvalds , Ingo Molnar , LKML , Andrew Morton , "Steven Rostedt (Red Hat)" , Peter Zijlstra , Masami Hiramatsu , Peter Zijlstra Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 16, 2015 at 5:57 AM, Michal Nazarewicz 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 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 thanks! -john