Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1079239ybl; Wed, 14 Aug 2019 10:21:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxumZ1oqVqLeDURtY1tzz0F6/uxFEaY1jUDHMJuDgD34cFQjNu/DI1EbqPwy9n573d1D1bG X-Received: by 2002:a65:430a:: with SMTP id j10mr245767pgq.374.1565803283182; Wed, 14 Aug 2019 10:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803283; cv=none; d=google.com; s=arc-20160816; b=I/Gz5GM6Mvo+DScLEpG+d5kvrcdUbDkmCLsEewfv/trvkzaOejOPtHvpZtm01TEOpc ndYHTYXjLLzqwT2+p0SjXPs/AdYHs9dFeVbOxYHVo/ECzts6XM0lO9kbGDCi2NNOns8Z /U5x8bGi3fjhwKN784Mty3Vuxuf1jO9gjHTygvT3E5Uf158Z03iHf1dC1ztpAWi++PMT MdIPgTQ9Ag5oJNQllRd8Y70e/VVlHtlT8bltpFWiuken8zYIv0yrHSkDCArDMf5glyRV urbq43egO7WpuAO59nmeaIWzMcGSZyAE/i++7yUcVZWPrjHrBpI0iSKaEFOkO+R1hI/v jQXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D0KkTmmGTIEL47W0m6ibuIJlUUc6TOTXnN2sBzpmKF0=; b=L8dO5Vm0ff/VwY4z7UN1qurWOnjCOJU+6xTPhBcpvRBwPEOCYtal+NHkmWSIq+RFaA bbrFgARwFLFbLJ6X2KLrRD1gR2rz18ubE3IP7G7z+NKiqT/EGbwQJnlqebojRkS3HPtq ubGnB1NI0eOHfsXEmSTvgAa/2QMN7pP2J1FGrp4SCzDiRfp/nGJzIcGzEwrtkmB960Da hlphdLeoOKO0AMCTk1xVlifItkaP8JBbAxhgbpaqWORkiGi4h0VreHjWe1M50kg+nTnU pXcDL6CqeA2VffM+RlB/iP0IUXwF0fH8GNRsq0GZyQUQJOATeBAXn+OoIQarHEU/bzVV imGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mQ9KieIV; 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 b6si85307pfd.29.2019.08.14.10.21.06; Wed, 14 Aug 2019 10:21:23 -0700 (PDT) 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=@kernel.org header.s=default header.b=mQ9KieIV; 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 S1730200AbfHNRUf (ORCPT + 99 others); Wed, 14 Aug 2019 13:20:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:33604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730496AbfHNRKj (ORCPT ); Wed, 14 Aug 2019 13:10:39 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 652E02084D; Wed, 14 Aug 2019 17:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802638; bh=wGnkXI/H79nU+O0BqQv0kJhREjEJ1fz8u7j98i5eA+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mQ9KieIVVnDnsBc6rlWTW1K1zRlB8XzyW+0Acv+IbaQhD8GC1AwnZI1bJT7mcGJxg LzWBjsK1Zwy9zsGmcFyrzJi7c/RUXNmz42zBjGLVhRoZD9KyodDAc05iQmYlZsneXT nYYwMFeBRnagyyxZ28MSsvENaXhP7NuNvyb3VPzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hanjun Guo , Dan Carpenter , Lorenzo Pieralisi , Will Deacon , Sudeep Holla , Catalin Marinas , Robin Murphy , Sasha Levin Subject: [PATCH 4.19 59/91] ACPI/IORT: Fix off-by-one check in iort_dev_find_its_id() Date: Wed, 14 Aug 2019 19:01:22 +0200 Message-Id: <20190814165752.092367336@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 5a46d3f71d5e5a9f82eabc682f996f1281705ac7 ] Static analysis identified that index comparison against ITS entries in iort_dev_find_its_id() is off by one. Update the comparison condition and clarify the resulting error message. Fixes: 4bf2efd26d76 ("ACPI: Add new IORT functions to support MSI domain handling") Link: https://lore.kernel.org/linux-arm-kernel/20190613065410.GB16334@mwanda/ Reviewed-by: Hanjun Guo Reported-by: Dan Carpenter Signed-off-by: Lorenzo Pieralisi Cc: Dan Carpenter Cc: Will Deacon Cc: Hanjun Guo Cc: Sudeep Holla Cc: Catalin Marinas Cc: Robin Murphy Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- drivers/acpi/arm64/iort.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 43c2615434b48..e11b5da6f828f 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -616,8 +616,8 @@ static int iort_dev_find_its_id(struct device *dev, u32 req_id, /* Move to ITS specific data */ its = (struct acpi_iort_its_group *)node->node_data; - if (idx > its->its_count) { - dev_err(dev, "requested ITS ID index [%d] is greater than available [%d]\n", + if (idx >= its->its_count) { + dev_err(dev, "requested ITS ID index [%d] overruns ITS entries [%d]\n", idx, its->its_count); return -ENXIO; } -- 2.20.1