Commit
2c77db77 "xen/arm: efi: Avoid duplicating the addition of a new
bank", introduced a new function meminfo_add_bank that add a new bank.
This new code fails to check correctly the size of the array which may
result to an out-of-bounds write.
Coverity-ID:
1433183
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
{
struct membank *bank;
- if ( mem->nr_banks > NR_MEM_BANKS )
+ if ( mem->nr_banks >= NR_MEM_BANKS )
return false;
bank = &mem->bank[mem->nr_banks];