diff options
author | Chen,Yugang <yugang.chen@linux.intel.com> | 2019-09-02 06:49:02 +0300 |
---|---|---|
committer | Chen,Yugang <yugang.chen@linux.intel.com> | 2019-09-02 06:49:57 +0300 |
commit | 71d8890eb9dfc6208df85125abeae0ca0e4be7fd (patch) | |
tree | 4015cd14def19347c4cba0f601f01f5aa69e532c | |
parent | c47789dcd9efbeb088915d77fb1f60c01d0cfdbc (diff) | |
download | provingground-71d8890eb9dfc6208df85125abeae0ca0e4be7fd.tar.xz |
Static code analysis scan issue fix
Fix the issues found during code static scan
Tested:
test in board, BMC can get SMBIOS data.
Change-Id: Ib4cd8e86251d5c2c10ce8a4968fb49db20e1bf1e
Signed-off-by: Chen,Yugang <yugang.chen@linux.intel.com>
-rw-r--r-- | services/smbios-mdrv2/src/cpu.cpp | 5 | ||||
-rw-r--r-- | services/smbios/src/cpu.cpp | 5 | ||||
-rw-r--r-- | services/smbios/src/dimm.cpp | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/services/smbios-mdrv2/src/cpu.cpp b/services/smbios-mdrv2/src/cpu.cpp index a0e2840..cda96da 100644 --- a/services/smbios-mdrv2/src/cpu.cpp +++ b/services/smbios-mdrv2/src/cpu.cpp @@ -158,6 +158,11 @@ void Cpu::processorInfoUpdate(void) uint8_t *dataIn = storage; dataIn = getSMBIOSTypePtr(dataIn, processorsType); + if (dataIn == nullptr) + { + return; + } + for (uint8_t index = 0; index < cpuNum; index++) { dataIn = smbiosNextPtr(dataIn); diff --git a/services/smbios/src/cpu.cpp b/services/smbios/src/cpu.cpp index b6cd382..a92d9e6 100644 --- a/services/smbios/src/cpu.cpp +++ b/services/smbios/src/cpu.cpp @@ -159,6 +159,11 @@ void Cpu::processorInfoUpdate(void) uint8_t *dataIn = regionS[0].regionData; dataIn = smbiosTypePtr(dataIn, processorsType); + if (dataIn == nullptr) + { + return; + } + for (uint8_t index = 0; index < cpuNum; index++) { dataIn = smbiosNextPtr(dataIn); diff --git a/services/smbios/src/dimm.cpp b/services/smbios/src/dimm.cpp index 6ac31aa..c4c1d15 100644 --- a/services/smbios/src/dimm.cpp +++ b/services/smbios/src/dimm.cpp @@ -28,6 +28,11 @@ void Dimm::memoryInfoUpdate(void) uint8_t *dataIn = regionS[0].regionData; dataIn = smbiosTypePtr(dataIn, memoryDeviceType); + if (dataIn == nullptr) + { + return; + } + for (uint8_t index = 0; index < dimmNum; index++) { dataIn = smbiosNextPtr(dataIn); |