Re: [U-Boot] [PATCH 1/2] pci: Add boundary check for hose->regions
On Tue, Apr 16, 2019 at 06:30:53PM +0200, Thierry Reding wrote: > On Fri, Mar 15, 2019 at 04:32:32PM +0100, Thierry Reding wrote: > > From: Thierry Reding > > > > Make sure that we don't overflow the hose->regions array, otherwise we > > would end up overwriting the hose->region_count field and cause mayhem > > to ensue. Also print an error message when we'd be overflowing because > > it indicates that there aren't enough regions available and the number > > needs to be increased. > > > > Signed-off-by: Thierry Reding > > --- > > drivers/pci/pci-uclass.c | 5 + > > 1 file changed, 5 insertions(+) > > Hi Tom, > > have you had a chance to look at these two patches? Simon's reviewed > them and they are needed to restore PCI support on Jetson TX2 (P2771). They're on my list, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] pci: Add boundary check for hose->regions
On Fri, Mar 15, 2019 at 04:32:32PM +0100, Thierry Reding wrote: > From: Thierry Reding > > Make sure that we don't overflow the hose->regions array, otherwise we > would end up overwriting the hose->region_count field and cause mayhem > to ensue. Also print an error message when we'd be overflowing because > it indicates that there aren't enough regions available and the number > needs to be increased. > > Signed-off-by: Thierry Reding > --- > drivers/pci/pci-uclass.c | 5 + > 1 file changed, 5 insertions(+) Hi Tom, have you had a chance to look at these two patches? Simon's reviewed them and they are needed to restore PCI support on Jetson TX2 (P2771). Thierry > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c > index 824fa1190747..cf1e7617ae35 100644 > --- a/drivers/pci/pci-uclass.c > +++ b/drivers/pci/pci-uclass.c > @@ -918,6 +918,11 @@ static void decode_regions(struct pci_controller *hose, > ofnode parent_node, > return; > > for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { > + if (hose->region_count == MAX_PCI_REGIONS) { > + pr_err("maximum number of regions parsed, aborting\n"); > + break; > + } > + > if (bd->bi_dram[i].size) { > pci_set_region(hose->regions + hose->region_count++, > bd->bi_dram[i].start, > -- > 2.20.1 > signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] pci: Add boundary check for hose->regions
On Fri, 15 Mar 2019 at 23:32, Thierry Reding wrote: > > From: Thierry Reding > > Make sure that we don't overflow the hose->regions array, otherwise we > would end up overwriting the hose->region_count field and cause mayhem > to ensue. Also print an error message when we'd be overflowing because > it indicates that there aren't enough regions available and the number > needs to be increased. > > Signed-off-by: Thierry Reding > --- > drivers/pci/pci-uclass.c | 5 + > 1 file changed, 5 insertions(+) Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] pci: Add boundary check for hose->regions
From: Thierry Reding Make sure that we don't overflow the hose->regions array, otherwise we would end up overwriting the hose->region_count field and cause mayhem to ensue. Also print an error message when we'd be overflowing because it indicates that there aren't enough regions available and the number needs to be increased. Signed-off-by: Thierry Reding --- drivers/pci/pci-uclass.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 824fa1190747..cf1e7617ae35 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -918,6 +918,11 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node, return; for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { + if (hose->region_count == MAX_PCI_REGIONS) { + pr_err("maximum number of regions parsed, aborting\n"); + break; + } + if (bd->bi_dram[i].size) { pci_set_region(hose->regions + hose->region_count++, bd->bi_dram[i].start, -- 2.20.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot