From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbbIOBFe (ORCPT ); Mon, 14 Sep 2015 21:05:34 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:35643 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751465AbbIOBFc (ORCPT ); Mon, 14 Sep 2015 21:05:32 -0400 From: John Stultz To: LKML Cc: John Stultz , Andrew Morton , Ingo Molnar , "Steven Rostedt (Red Hat)" , Peter Zijlstra , Masami Hiramatsu , Michal Nazarewicz , Prarit Bhargava , Richard Cochran , Thomas Gleixner , "Theodore Ts'o" , Andreas Dilger , Dave Chinner , Tejun Heo , Joe Perches Subject: [RFC][PATCH 0/5] Fixes for abs() usage on 64bit values Date: Mon, 14 Sep 2015 18:05:19 -0700 Message-Id: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As noted in include/linux/kernel.h: "abs() should not be used for 64-bit types (s64, u64, long long) - use abs64() for those." Unfortunately, there are quite a number of places where abs() was used w/ 64bit values in the kernel, and the results are then silently capped to 32-bit values on 32-bit systems. This series tries to address the problematic sites I found, and then introduces a patch which modifies abs() so that the build will fail if a 64-bit type is passed to it on a 32-bit machine. I'm sure there are additional sites that will need fixing, but hopefully this will make them easy to find. Comments and feedback would be greatly appreciated! Thanks -john Cc: Andrew Morton Cc: Ingo Molnar Cc: "Steven Rostedt (Red Hat)" Cc: Peter Zijlstra Cc: Masami Hiramatsu Cc: Michal Nazarewicz Cc: Prarit Bhargava Cc: Richard Cochran Cc: Thomas Gleixner Cc: "Theodore Ts'o" Cc: Andreas Dilger Cc: Dave Chinner Cc: Tejun Heo Cc: Joe Perches John Stultz (5): clocksource: Fix abs() usage w/ 64bit values time: Fix abs() usage with 64-bit values. ext4: Fix abs() usage in ext4_mb_check_group_pa percpu: Fix abs() usage in percpu_counter_compare() abs(): Provide build error on passing 64bit value to abs() fs/ext4/mballoc.c | 4 ++-- include/linux/kernel.h | 3 +++ kernel/time/clocksource.c | 2 +- kernel/time/timekeeping.c | 2 +- lib/percpu_counter.c | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) -- 1.9.1