diff options
author | Chen Yugang <yugang.chen@linux.intel.com> | 2019-06-24 12:08:32 +0300 |
---|---|---|
committer | Chen, Yugang <yugang.chen@intel.com> | 2019-06-28 10:36:28 +0300 |
commit | f7e65dbce8a1eced8e6cc5018c7c9e922f1591a7 (patch) | |
tree | aea58a427cf198ca8ae916f41fd1a9660951e1e5 /services | |
parent | 2c94bc2e81402ee9682e30a9326f947f2c4b2c72 (diff) | |
download | provingground-f7e65dbce8a1eced8e6cc5018c7c9e922f1591a7.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: I09cfb88d29852436bc901945d5545f2f19a5531a
Signed-off-by: Chen Yugang <yugang.chen@linux.intel.com>
Diffstat (limited to 'services')
-rw-r--r-- | services/smbios-mdrv2/src/dimm.cpp | 5 | ||||
-rw-r--r-- | services/smbios-mdrv2/src/mdrv2.cpp | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/services/smbios-mdrv2/src/dimm.cpp b/services/smbios-mdrv2/src/dimm.cpp index a1e0895..e8c891d 100644 --- a/services/smbios-mdrv2/src/dimm.cpp +++ b/services/smbios-mdrv2/src/dimm.cpp @@ -29,6 +29,11 @@ void Dimm::memoryInfoUpdate(void) uint8_t *dataIn = storage; dataIn = getSMBIOSTypePtr(dataIn, memoryDeviceType); + + if (dataIn == nullptr) + { + return; + } for (uint8_t index = 0; index < dimmNum; index++) { dataIn = smbiosNextPtr(dataIn); diff --git a/services/smbios-mdrv2/src/mdrv2.cpp b/services/smbios-mdrv2/src/mdrv2.cpp index 91fb617..1a2fbcb 100644 --- a/services/smbios-mdrv2/src/mdrv2.cpp +++ b/services/smbios-mdrv2/src/mdrv2.cpp @@ -268,6 +268,10 @@ bool MDR_V2::sendDirectoryInformation(uint8_t dirVersion, uint8_t dirIndex, uint8_t idIndex = dirIndex; uint8_t *pData = dirEntry.data(); + if (pData == nullptr) + { + return false; + } for (uint8_t index = 0; index < returnedEntries; index++) { auto data = reinterpret_cast<const Mdr2DirEntry *>(pData); |