* [PATCH] ACPI/IORT: Fix off-by-one check in iort_dev_find_its_id()
@ 2019-07-22 16:25 Lorenzo Pieralisi
2019-07-23 1:48 ` Hanjun Guo
0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Pieralisi @ 2019-07-22 16:25 UTC (permalink / raw)
To: linux-acpi
Cc: Lorenzo Pieralisi, Catalin Marinas, Hanjun Guo, Robin Murphy,
LKML, LAKML, Sudeep Holla, Will Deacon, Dan Carpenter
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/
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Will Deacon <will@kernel.org>
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
---
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 15dbfd657d82..5a7551d060f2 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.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI/IORT: Fix off-by-one check in iort_dev_find_its_id()
2019-07-22 16:25 [PATCH] ACPI/IORT: Fix off-by-one check in iort_dev_find_its_id() Lorenzo Pieralisi
@ 2019-07-23 1:48 ` Hanjun Guo
0 siblings, 0 replies; 2+ messages in thread
From: Hanjun Guo @ 2019-07-23 1:48 UTC (permalink / raw)
To: Lorenzo Pieralisi, linux-acpi
Cc: Catalin Marinas, LKML, LAKML, Sudeep Holla, Will Deacon,
Dan Carpenter, Robin Murphy
On 2019/7/23 0:25, Lorenzo Pieralisi wrote:
> 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/
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Hanjun Guo <guohanjun@huawei.com>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-23 1:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22 16:25 [PATCH] ACPI/IORT: Fix off-by-one check in iort_dev_find_its_id() Lorenzo Pieralisi
2019-07-23 1:48 ` Hanjun Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).