linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI/IORT: fix the iort_id_map function
@ 2019-12-15 15:12 Pankaj Bansal
  2019-12-16  3:49 ` Hanjun Guo
  0 siblings, 1 reply; 7+ messages in thread
From: Pankaj Bansal @ 2019-12-15 15:12 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, Rafael J . Wysocki,
	Len Brown
  Cc: linux-acpi, linux-arm-kernel, Pankaj Bansal

As per http://infocenter.arm.com/help/topic/com.arm.doc.den0049d/DEN0049D_IO_Remapping_Table.pdf
in ID mappings:
Number of IDs = The number of IDs in the range minus one.

Therefore, it's valid for ID mapping to contain single device mapping which
would have Number of IDs field 0.

The iort_id_map doesn't handle this case, fix this case.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
---
 drivers/acpi/arm64/iort.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 33f71983e001..b9b108d0ca0b 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -315,7 +315,7 @@ static int iort_id_map(struct acpi_iort_id_mapping *map, u8 type, u32 rid_in,
 	}
 
 	if (rid_in < map->input_base ||
-	    (rid_in >= map->input_base + map->id_count))
+	    (rid_in > map->input_base + map->id_count))
 		return -ENXIO;
 
 	*rid_out = map->output_base + (rid_in - map->input_base);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-17 13:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15 15:12 [PATCH] ACPI/IORT: fix the iort_id_map function Pankaj Bansal
2019-12-16  3:49 ` Hanjun Guo
2019-12-16  5:14   ` Pankaj Bansal
2019-12-16 11:54     ` Hanjun Guo
2019-12-16 17:17       ` Pankaj Bansal
2019-12-17 11:58         ` Pankaj Bansal
2019-12-17 13:00           ` 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).