pci: Add boundary check for hose->regions
authorThierry Reding <treding@nvidia.com>
Fri, 15 Mar 2019 15:32:32 +0000 (16:32 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 23 Apr 2019 21:57:23 +0000 (17:57 -0400)
commitd94d9aa675b2d8a50b8b66b07f3210d291f7eaff
treeb23369b36dbb5744eb1baec233243b49e42e12c0
parent248b873541d0d62f45b3a08bffeb0523c2746f4c
pci: Add boundary check for hose->regions

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 <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/pci/pci-uclass.c