Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2988280imu; Sun, 9 Dec 2018 14:24:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/WSfMTM0uhKw7LgnGXXaPnyMO+nN6XSNcF+i/LtXSG8+6r+k1bW0NpjN0NmBiXpL+P0Cpyp X-Received: by 2002:a63:4f5e:: with SMTP id p30mr8901243pgl.71.1544394240124; Sun, 09 Dec 2018 14:24:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544394240; cv=none; d=google.com; s=arc-20160816; b=uK72669WdoMwVIhfWOSTIYT6nKmiFZVsmcy3/QXXGuz66YxckdqBbphNwwbXiz5Of0 bbKzL1vXAS2wuu304PHPedjmm50SE+ttvTwiDHwyrzAC2+oFfk8dxTY5QE1VNilmdePk g6splOla/WmcSih4eDKpApVK5Y/HXZiyneiF9uMm30DeKBGil2AobR4Ccf9R3O5gQLW8 QT2bLyDHOsiFfkbqOKL+MPCPWrGwERKC0uWqWzGVdB1abyEIks71yDChBiq5cEJjLyl7 WFBb7PNkn89EHlKRLJMe5PHiHYJyRG4mv7pucshPMb1utUV+ntz682IOqiG7UPgRuF5L GX6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=Ik9Ev3v/FrwzAGReoXENxz6yz3wGF2vFnCRji2MuSzE=; b=d9TaVe6t+pZzdH7j7duqIpt+YkHP0rJxAuNdXtbqcOkMynd543XSp2GXUBzZW+/FwM Wn61vDrGlC2rhxlnuZKYN1NUg2qhqJl4WYs/+voD0mb0HJ5u7m/KcgJnz4Rv+SzmtBLZ 2cr92SRCCKQhY93e7UF9GlirtVAh3xvdv7FlO2RkBDpex1Rxb/0jWFw3pb80T2VxJBA8 GhGWyYZSLxfR93vOUqELSJRVcwPGpN4XLYFj/0NOMqDyGeqkz9g8BD0vOlIFcLnZtskc wC2dDMDJTwCT1qruZFfd86Y7UYejO+cxVxEEf2mpNVFldIC82BevRWQwVYkiZvMx9DOL t7+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92si8777278pld.84.2018.12.09.14.23.45; Sun, 09 Dec 2018 14:24:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728091AbeLIWVU (ORCPT + 99 others); Sun, 9 Dec 2018 17:21:20 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35290 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726532AbeLIVzX (ORCPT ); Sun, 9 Dec 2018 16:55:23 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW72l-0002io-4Y; Sun, 09 Dec 2018 21:55:19 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72i-0003aF-Dd; Sun, 09 Dec 2018 21:55:16 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Thomas Petazzoni" , "Russell King" , "Nicolas Pitre" , "Thomas Petazzoni" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 248/328] ARM: 8799/1: mm: fix pci_ioremap_io() offset check In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Petazzoni commit 3a58ac65e2d7969bcdf1b6acb70fa4d12a88e53e upstream. IO_SPACE_LIMIT is the ending address of the PCI IO space, i.e something like 0xfffff (and not 0x100000). Therefore, when offset = 0xf0000 is passed as argument, this function fails even though the offset + SZ_64K fits below the IO_SPACE_LIMIT. This makes the last chunk of 64 KB of the I/O space not usable as it cannot be mapped. This patch fixes that by substracing 1 to offset + SZ_64K, so that we compare the addrss of the last byte of the I/O space against IO_SPACE_LIMIT instead of the address of the first byte of what is after the I/O space. Fixes: c2794437091a4 ("ARM: Add fixed PCI i/o mapping") Signed-off-by: Thomas Petazzoni Acked-by: Nicolas Pitre Signed-off-by: Russell King Signed-off-by: Ben Hutchings --- arch/arm/mm/ioremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -447,7 +447,7 @@ void pci_ioremap_set_mem_type(int mem_ty int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr) { - BUG_ON(offset + SZ_64K > IO_SPACE_LIMIT); + BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT); return ioremap_page_range(PCI_IO_VIRT_BASE + offset, PCI_IO_VIRT_BASE + offset + SZ_64K,