DeviceIndex is used as index in Slot[]. The max size of Slot[]
is SD_PEIM_MAX_SLOTS. So DeviceIndex should be checked before used.
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
\r
Private = GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);\r
\r
- if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {\r
+ if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) || (DeviceIndex > SD_PEIM_MAX_SLOTS)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
return EFI_SUCCESS;\r
}\r
\r
- if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {\r
+ if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) || (DeviceIndex > SD_PEIM_MAX_SLOTS)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r