From patchwork Fri Jan 10 10:23:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 3465511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 978769F169 for ; Fri, 10 Jan 2014 10:28:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE1F520122 for ; Fri, 10 Jan 2014 10:28:49 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E3C620121 for ; Fri, 10 Jan 2014 10:28:48 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1ZKU-0005HW-C3; Fri, 10 Jan 2014 10:28:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1ZKR-0005kg-SC; Fri, 10 Jan 2014 10:28:39 +0000 Received: from mail-wi0-f178.google.com ([209.85.212.178]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1ZKP-0005k1-58 for linux-arm-kernel@lists.infradead.org; Fri, 10 Jan 2014 10:28:38 +0000 Received: by mail-wi0-f178.google.com with SMTP id bz8so4623428wib.17 for ; Fri, 10 Jan 2014 02:28:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id; bh=P3jhpzabrM3eMn3YeEIpyyv7eFjf61mU3HK0m4vmOA8=; b=Nnf4Gsy+omhk8FiGfr5dEQNy1bC9kE5Q6pl+Ki9pUYlQ4KxaTSONigEfJoxNqQndO0 R8C99UpVKllMRgntGV37CA+pqScuCXDytUhEgO7jk2EOmCNVPD/LwAeAjNpbDfzDlhCg XSVINOX7egqHPsw63QPqXNsneHwYU0UsSU54Y07B8NcbhWsgc0fI8Faz7oFq+OfgQIcd so8Ykp7duHRCE0+QHIv2gcIjvYAFpXvHbyLG0s2uHIK8q0GaW81leokmu3edEvK78c1y QoMHmM9p8dtDCFBLybyiXPYI70EmQ7m6L3XcDJ5DlW6U2GBBixXzfO2lT5hIJo2R9R+r +CNw== X-Received: by 10.180.77.131 with SMTP id s3mr1840939wiw.25.1389349689617; Fri, 10 Jan 2014 02:28:09 -0800 (PST) Received: from stedf17-labo202.ds.jdsu.net. (4-161.80-90.static-ip.oleane.fr. [90.80.161.4]) by mx.google.com with ESMTPSA id po3sm3727095wjc.3.2014.01.10.02.28.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Jan 2014 02:28:08 -0800 (PST) From: Jean-Jacques Hiblot To: thomas.petazzoni@free-electrons.com Subject: [PATCH] mvebu : pcie: dt: potential issue in range parsing Date: Fri, 10 Jan 2014 11:23:51 +0100 Message-Id: <1389349431-7997-1-git-send-email-jjhiblot@traphandler.com> X-Mailer: git-send-email 1.8.5.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140110_052837_288743_0F9E9270 X-CRM114-Status: GOOD ( 10.51 ) X-Spam-Score: -2.6 (--) Cc: gregory.clement@free-electrons.com, Jean-Jacques Hiblot , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The second parameter of of_read_number is not the index, but a size. As it happens, in this case it may work just fine because of the the conversion to u32 and the favorable endianness on this architecture. Signed-off-by: Jean-Jacques Hiblot Acked-by: Thomas Petazzoni Tested-by: Thomas Petazzoni Acked-by: Jason Cooper --- drivers/pci/host/pci-mvebu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index c269e43..877e8ce 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c @@ -768,7 +768,7 @@ static int mvebu_get_tgt_attr(struct device_node *np, int devfn, for (i = 0; i < nranges; i++) { u32 flags = of_read_number(range, 1); - u32 slot = of_read_number(range, 2); + u32 slot = of_read_number(range + 1, 1); u64 cpuaddr = of_read_number(range + na, pna); unsigned long rtype;