Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1084615ybl; Wed, 14 Aug 2019 10:26:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1Z93XxV5E12un/8X+PagM5DgBTZYLklNcSVxrMA5LWb9CRISgxaqcrn+SKHuhu+zuvEcL X-Received: by 2002:a63:590f:: with SMTP id n15mr270215pgb.190.1565803600234; Wed, 14 Aug 2019 10:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803600; cv=none; d=google.com; s=arc-20160816; b=LwSxZbh+fykEY/wW7g+GwcaNtAw78QNqAIm6/wGuTiGHJY7+8r8mYz+Gzez4W774+p ifSv96WuV7BWdHhK6rPzr8LXmPP8trrM06NEwfgEXPmrEwUvOPDKGpPUwN/MLgQEPB1X Y6kqdb4WIGr6YBMHN1txBoWnOmNZhP2Mn7vcrjpW4a/NmMylPsfmbMpBirVxTRnzPK5r g09bDHNNkXDkS6R+w57hCinCrN2+yhKYFfpwBCQHFgeVDmMY/UiT5O23kxAY1H7PV9Qi 2nwUnBklARW1dwA0dOzrkuufV0VOMtPxYrEsIePTOFMsuk64Q0wTakWBh2oNJr/e6yBJ ftRQ== 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=A7YUgh3BAbbJpMHnYhZr8o5xiV6zVlcIlMptmDl8I60=; b=JPVgZzJWSrx/ceFrDr9bjqag7AhfiS3k/aXSikzNL0WSewUd6+zaJbQDtg5BqZqQdX TWnuHirpxt0DK905IDQqujgUVbE7BwPtqv6i5/MCXZetx8MFyM3pcfrY1b1e6/1kN7vY gAE0kGQvA44OtdMU2VLglyiyIuEPvYxUDfjXXNm1M8yeWsAvM9o1yXCo0GINIYXY2M5h HYlmAoBD5E7tcvpFnNXw9s88pVcQA8FK5etKCmpu1MAiHFn83wQ+B2xScgtuLPNxJgM0 w6cAzkigG7I48y3YO8g8l2wu8Q2Ql03/84XqTGG7+pYZCmxC0SUEgdzkrykGpw7xwCKD G8Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=omp4wrR7; 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 x6si249124plm.396.2019.08.14.10.26.23; Wed, 14 Aug 2019 10:26:40 -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=omp4wrR7; 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 S1728907AbfHNRGZ (ORCPT + 99 others); Wed, 14 Aug 2019 13:06:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:55382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729154AbfHNRGQ (ORCPT ); Wed, 14 Aug 2019 13:06:16 -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 70F942173E; Wed, 14 Aug 2019 17:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802375; bh=gzAPQrEOeKbzsW7yBdTU38srUvitRFtUlGoMl95tyjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=omp4wrR7BEdvzj31Dt1y7m2fgFfbgIytrQszIswKNzo/G1W3kHAU9OD1tdmrEG3fO VLL9eicXWHtPhda4nH1IXwN5YmlCaqQVmxq9O+1mD/29epD5fCllCPoQqM2uM3YB0e YdzTXElrx8VotEM9A3ENvdeLsgfkAOWm6TwNVBZE= 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 5.2 102/144] ACPI/IORT: Fix off-by-one check in iort_dev_find_its_id() Date: Wed, 14 Aug 2019 19:00:58 +0200 Message-Id: <20190814165804.158940439@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@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 d4551e33fa716..8569b79e8b581 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -611,8 +611,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