dm: validation for input to public functions

slot value should be checked in range before used to access
bi->slotinfo[].

Tracked-On: #3822
Signed-off-by: Gao Junhao <junhao.gao@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Gao Junhao 2019-10-15 01:31:24 +00:00 committed by ACRN System Integration
parent 477f8331eb
commit 43b2327eb8
1 changed files with 2 additions and 0 deletions

View File

@ -2490,6 +2490,8 @@ pci_get_vdev_info(int slot)
bi = pci_businfo[0]; bi = pci_businfo[0];
if (bi == NULL) if (bi == NULL)
return NULL; return NULL;
if (slot < 0 || slot >= MAXSLOTS)
return NULL;
si = &bi->slotinfo[slot]; si = &bi->slotinfo[slot];
if (si != NULL) if (si != NULL)