From c17d76ab5e84336bd98da30e0ea716f6a779e4ce Mon Sep 17 00:00:00 2001 From: "Rob Herring (Arm)" Date: Fri, 31 May 2024 08:31:49 -0500 Subject: [PATCH] checks: Check the overall length of "interrupt-map" It is possible the overall length of "interrupt-map" is shorter than expected. A likely scenario is if "#address-cells" in the interrupt parent is not accounted for and there is only a single map entry. With multiple entries, one of the other tests would likely fail. Signed-off-by: Rob Herring (Arm) Message-ID: <20240531133149.1498139-1-robh@kernel.org> Signed-off-by: David Gibson --- checks.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/checks.c b/checks.c index 2fb7ee5..10fb638 100644 --- a/checks.c +++ b/checks.c @@ -1675,6 +1675,10 @@ static void check_interrupt_map(struct check *c, parent_cellsize += propval_cell(cellprop); cell += 1 + parent_cellsize; + if (cell > map_cells) + FAIL_PROP(c, dti, node, irq_map_prop, + "property size (%d) mismatch, expected %zu", + irq_map_prop->val.len, cell * sizeof(cell_t)); } } WARNING(interrupt_map, check_interrupt_map, NULL, &phandle_references, &addr_size_cells, &interrupt_provider);