From patchwork Tue Sep 23 09:59:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 37725 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 59D1120792 for ; Tue, 23 Sep 2014 10:24:57 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id ho1sf2360183wib.8 for ; Tue, 23 Sep 2014 03:24:56 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=YyyAg/oDAqKJ44lDhEGrerO47zj0b9/5bHDgKcnBrX0=; b=K7GoEVI2sdGsq3TxPcShBDpBkeAwqOxobwVg+LSpZjNR7YWBt7wthE95ey1xnwEOYg 8jb1vRLoIRRkRxDYf39xzmsaJcup6S2YegECLLGAdN4twF6cwg+RmhL6DiwO6vzADDHI tkbnG6TAyCbiExxhmuOe+pU/PBuHu4uAj4OovguIZbSWP6efyIGGDv1iSCcaXukE4+Bj RRYT3pcadCqQuf2RnQoLNG/FJSRsUgFeCuyYhGGMVvOmFU+dfUUMJGmGd+O3n4ps2avW FluCy4UZot4w1EmQeHc26listgS9ZeC9RvQYgOCnvTCQBA8kdE0/PJLP0sYkpZtmK6cP 8WRg== X-Gm-Message-State: ALoCoQlYimw83j6W9S+Zlqva9tvraUNj6sKlEZ0j3IZ72l+UAHtomUOFD7qINYmN80DYg8S8vY3X X-Received: by 10.180.76.230 with SMTP id n6mr2871651wiw.0.1411467896566; Tue, 23 Sep 2014 03:24:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.2 with SMTP id p2ls36139lag.10.gmail; Tue, 23 Sep 2014 03:24:56 -0700 (PDT) X-Received: by 10.152.9.37 with SMTP id w5mr31337485laa.28.1411466361946; Tue, 23 Sep 2014 02:59:21 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com [209.85.215.47]) by mx.google.com with ESMTPS id pt7si17838507lbb.120.2014.09.23.02.59.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Sep 2014 02:59:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id mc6so8197095lab.6 for ; Tue, 23 Sep 2014 02:59:21 -0700 (PDT) X-Received: by 10.152.246.6 with SMTP id xs6mr31720700lac.56.1411466361843; Tue, 23 Sep 2014 02:59:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp381573lbb; Tue, 23 Sep 2014 02:59:21 -0700 (PDT) X-Received: by 10.66.169.73 with SMTP id ac9mr14490847pac.102.1411466360385; Tue, 23 Sep 2014 02:59:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id uz1si19634267pac.182.2014.09.23.02.59.19 for ; Tue, 23 Sep 2014 02:59:20 -0700 (PDT) Received-SPF: none (google.com: devicetree-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755231AbaIWJ7S (ORCPT + 5 others); Tue, 23 Sep 2014 05:59:18 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:33711 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754825AbaIWJ7S (ORCPT ); Tue, 23 Sep 2014 05:59:18 -0400 Received: by mail-wi0-f180.google.com with SMTP id q5so4679341wiv.1 for ; Tue, 23 Sep 2014 02:59:16 -0700 (PDT) X-Received: by 10.180.13.79 with SMTP id f15mr3056986wic.25.1411466356794; Tue, 23 Sep 2014 02:59:16 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-78-149-10-230.as13285.net. [78.149.10.230]) by mx.google.com with ESMTPSA id k10sm15292005wjb.28.2014.09.23.02.59.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Sep 2014 02:59:15 -0700 (PDT) From: Srinivas Kandagatla To: Grant Likely , devicetree@vger.kernel.org Cc: Rob Herring , linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH] of: fdt: fix memory range check Date: Tue, 23 Sep 2014 10:59:09 +0100 Message-Id: <1411466349-14166-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@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.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In cases where board has below memory DT node memory{ device_type = "memory"; reg = <0x80000000 0x80000000>; }; Check on the memory range in fdt.c will always fail because it is comparing MAX_PHYS_ADDR with base + size, in fact it should compare it with base + size - 1. This issue was originally noticed on Qualcomm IFC6410 board. Without this patch kernel shows up noticed unnecessary warnings [ 0.000000] Machine model: Qualcomm APQ8064/IFC6410 [ 0.000000] Ignoring memory range 0xffffffff - 0x100000000 [ 0.000000] cma: Reserved 64 MiB at ab800000 as a result the size get reduced to 0x7fffffff which looks wrong. This patch fixes the check involved in generating this warning and as a result it also fixes the wrong size calculation. Signed-off-by: Srinivas Kandagatla --- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 79cb831..3f5736c 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -937,7 +937,7 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) return; } - if (base + size > MAX_PHYS_ADDR) { + if (base + size - 1 > MAX_PHYS_ADDR) { pr_warning("Ignoring memory range 0x%lx - 0x%llx\n", ULONG_MAX, base + size); size = MAX_PHYS_ADDR - base;