On Fri, Aug 16, 2019 at 12:59:51PM +0200, Marek Vasut wrote: > On 8/16/19 12:52 PM, Lorenzo Pieralisi wrote: > > On Fri, Aug 09, 2019 at 07:57:39PM +0200, marek.vasut@xxxxxxxxx wrote: > >> From: Marek Vasut <marek.vasut+renesas@xxxxxxxxx> > >> > >> Since the $idx variable value is stored across multiple calls to > >> rcar_pcie_inbound_ranges() function, and the $idx value is used to > >> index registers which are written, subsequent calls might cause > >> the $idx value to be high enough to trigger writes into nonexistent > >> registers. > > > > Can this really happen ? 'index' is initialized to 0 in > > rcar_pci_parse_map_dma_ranges() and, through rcar_pcie_inbound_ranges() > > return value, it bails out on idx overrun, we can argue this patch > > improves robustness but I do not think it is fixing anything. > > We probably don't want to write into non-existent registers ? I have not questioned that. > I think it can happen when there are too many ranges in DT. Yes that's true when idx == MAX_NR_INBOUND_MAPS, forgive me the question. Lorenzo