From patchwork Thu Dec 26 09:50:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 182451 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp1501647ild; Thu, 26 Dec 2019 01:51:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyiyefvdRVsEjDsVUY9KvR2LF7KZDCXlSxPDeUjxC1pM94VCPckQGe4MqEimbxbKK4gt+gA X-Received: by 2002:a9d:7b4a:: with SMTP id f10mr51954201oto.4.1577353919116; Thu, 26 Dec 2019 01:51:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577353919; cv=none; d=google.com; s=arc-20160816; b=XPkZD3k1xZRrOB6kc7WBFCqGoG7u3yhWO6S5IXpFgcSCEtWDs+xihIwACYGkQikrHe CgFo3Y+ZxlevxuZ2OBbq+fOEK9UpFISMurtimgfiXCO5zC4ryTwX1AFlW5SYsJyoqois zKeLQxlIcVdX1yUY46F+6wwmkU02rZ8zp4MITlJp/C+Ba12AB0whnXMEUypEEuX7PFGO 2dbCmnjKuAwfREoGac3oMxGj/5h83DzLfg9l1eY06du94KOIn5xXxEpn8RJ5qpCKqemI 74JK5ZvgE60ly+iL104Xt/4oBGZsQFbNNlCen1aeBac+eFT7XvrulD9DuKNltrkioVU8 eTKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=NhUagKKjH1a+HNNxh90mRJCDlPp2AH9R9coPb0ehMDo=; b=YavI2oyHbeVrgptA8di7gfYhxEmk7YW/AR77rh5OzLa/8ElfNIpt117zfHFIB9irdH rAdbjhGyTgbcu6P4pi0F01ZMghFhBkCLBWlwydirT3CuQcF8FJtoM7cWpUucS1FuNuFX irKOTPmTV2v5D4SOAf5RDw3WmAyo3jZdcx9hljyn0QGeKtYtFU51JcUzYzr5GCg/sCUh epqqYwBjWoxcbbaiLsU0R/aZKVWZ+DPApylUpBz/cfjXOQ84txIp9bOE3aIzFos8Pkg1 /IscjMEWrQvoLuTeJb39tkNOJbdWwvSglORq4RjS6cEOOkAj3JicqwtqTnSmiRP1FTnp s/yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=sQKn9VfB; 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 16si18845648otk.151.2019.12.26.01.51.58; Thu, 26 Dec 2019 01:51:59 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=sQKn9VfB; 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 S1726440AbfLZJv5 (ORCPT + 27 others); Thu, 26 Dec 2019 04:51:57 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:32975 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbfLZJv5 (ORCPT ); Thu, 26 Dec 2019 04:51:57 -0500 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id xBQ9owph023896; Thu, 26 Dec 2019 18:50:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com xBQ9owph023896 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1577353859; bh=NhUagKKjH1a+HNNxh90mRJCDlPp2AH9R9coPb0ehMDo=; h=From:To:Cc:Subject:Date:From; b=sQKn9VfBXtp3Wxh+M4b0yfgWfx/dlWKr4ftTQnJKm5YVElGOQPbAa5TqibegXpMGI molTYuHv+JNa/Kawe+PsWljhzyRbE/fS8souFOI0UCIPwvL4qPGYGjtIAu7wn0jywI zUYem3YY0FuMc5NDk4MYRtaVewslii2O7x8HH5XmUYqfi/YGJLbaK3EgGiSmPhu8tb IGlpkG3YavBEnrxdn2qfszs89QVjRnuSCjo6EZ6fxhs5D5CI4+WDZfGbKgOK5oDYed 8uxWd91lcgBgJt3ay12uZl0UQ/tH6AoGFR6n7gO01+Nb1f2ejee7RftuXPt6xqJg4v eHf2aL+Nh31tA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Will Deacon , Robin Murphy , linux-arm-kernel@lists.infradead.org, Joerg Roedel , iommu@lists.linux-foundation.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH] iommu/arm-smmu-v3: fix resource_size check Date: Thu, 26 Dec 2019 18:50:56 +0900 Message-Id: <20191226095056.30256-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an off-by-one mistake. resource_size() returns res->end - res->start + 1. Signed-off-by: Masahiro Yamada --- drivers/iommu/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index d9e0d9c19b4f..b463599559d2 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -3599,7 +3599,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) /* Base address */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (resource_size(res) + 1 < arm_smmu_resource_size(smmu)) { + if (resource_size(res) < arm_smmu_resource_size(smmu)) { dev_err(dev, "MMIO region too small (%pr)\n", res); return -EINVAL; }