From patchwork Tue Sep 15 01:05:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 53609 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 4996B22B17 for ; Tue, 15 Sep 2015 01:05:43 +0000 (UTC) Received: by lbbmp1 with SMTP id mp1sf51148885lbb.2 for ; Mon, 14 Sep 2015 18:05:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=UdYuKLbtqbS51JQNFaMz32GPUQuw6odF0ZchGLw2pTU=; b=fUQQpfsIGmutirz19eb3lrlp4O//m7E9+SSiM9dhwY03XpMcLJXO1CaPg3hiTPCEbe ro5p4ft8m04FdzmqAGchywwKGpTeHPuFmGRUG9LBHuGCpJCML2NqCAzNOh5gNAdsgED7 XLFBfrLUNKPW6RCW5VghSry2bykmcqMnyCO1pbNpudiH9Hw87ON8/3/anM9AiiLpQ8H8 2nE1QVXi2mgwBLMtf/m1a34DCSLnHM2LzeAwZvZkD7Tcnv1VQvZ3ayfOerrdlBx28dZR SRFMoz1fcR7V+u9mqYIehxEEW0kTESi88vIqLi7aqaJoS6BVv/u9HlXacbJnz+p9eFyS slYQ== X-Gm-Message-State: ALoCoQnQSeuc9xzh6TqybXmbhMqC9dxR4xFdZuMfIXQrQV+jYC6GdpC0RObEU8BIIXTRTO/k6awS X-Received: by 10.180.208.108 with SMTP id md12mr47879wic.1.1442279141402; Mon, 14 Sep 2015 18:05:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.33 with SMTP id j1ls277560laf.56.gmail; Mon, 14 Sep 2015 18:05:41 -0700 (PDT) X-Received: by 10.112.204.162 with SMTP id kz2mr17410645lbc.115.1442279141114; Mon, 14 Sep 2015 18:05:41 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id d6si11532144lab.61.2015.09.14.18.05.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 18:05:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lahg1 with SMTP id g1so67784231lah.1 for ; Mon, 14 Sep 2015 18:05:41 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr17419076lbb.112.1442279141017; Mon, 14 Sep 2015 18:05:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1489204lbq; Mon, 14 Sep 2015 18:05:39 -0700 (PDT) X-Received: by 10.66.191.131 with SMTP id gy3mr40470430pac.113.1442279136267; Mon, 14 Sep 2015 18:05:36 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com. [209.85.220.50]) by mx.google.com with ESMTPS id gh4si27257627pbc.211.2015.09.14.18.05.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 18:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.50 as permitted sender) client-ip=209.85.220.50; Received: by padhy16 with SMTP id hy16so158820037pad.1 for ; Mon, 14 Sep 2015 18:05:35 -0700 (PDT) X-Received: by 10.68.166.196 with SMTP id zi4mr40707897pbb.83.1442279135346; Mon, 14 Sep 2015 18:05:35 -0700 (PDT) Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id td5sm18441531pbc.67.2015.09.14.18.05.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Sep 2015 18:05:34 -0700 (PDT) From: John Stultz To: LKML Cc: John Stultz , "Theodore Ts'o" , Andreas Dilger , Ingo Molnar , linux-ext4@vger.kernel.org Subject: [RFC][PATCH 3/5] ext4: Fix abs() usage in ext4_mb_check_group_pa Date: Mon, 14 Sep 2015 18:05:22 -0700 Message-Id: <1442279124-7309-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> References: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The ext4_fsblk_t type is a long long, which should not be used with abs(), as is done in ext4_mb_check_group_pa(). This patch modifies ext4_mb_check_group_pa() to use abs64() instead. Cc: "Theodore Ts'o" Cc: Andreas Dilger Cc: Ingo Molnar Cc: linux-ext4@vger.kernel.org Signed-off-by: John Stultz --- fs/ext4/mballoc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 34b610e..4780ab1 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -3331,8 +3331,8 @@ ext4_mb_check_group_pa(ext4_fsblk_t goal_block, atomic_inc(&pa->pa_count); return pa; } - cur_distance = abs(goal_block - cpa->pa_pstart); - new_distance = abs(goal_block - pa->pa_pstart); + cur_distance = abs64(goal_block - cpa->pa_pstart); + new_distance = abs64(goal_block - pa->pa_pstart); if (cur_distance <= new_distance) return cpa;