addrmap: Fix off by one in addrmap_set_entry()

The > comparison needs to be changed to >= to prevent an out of bounds
write on th next line.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Dan Carpenter 2023-07-25 09:50:40 +03:00 committed by Tom Rini
parent c594b43022
commit 7dd06b1621

View file

@ -59,7 +59,7 @@ void *addrmap_phys_to_virt(phys_addr_t paddr)
void addrmap_set_entry(unsigned long vaddr, phys_addr_t paddr,
phys_size_t size, int idx)
{
if (idx > CONFIG_SYS_NUM_ADDR_MAP)
if (idx >= CONFIG_SYS_NUM_ADDR_MAP)
return;
address_map[idx].vaddr = vaddr;