Static analysis FTW

- a bit of leftovers for previous commit found by static analyzer
This commit is contained in:
Nikolaj Schlej 2016-04-17 01:48:07 +02:00
parent cda0018a29
commit dd0efa2410
2 changed files with 23 additions and 8 deletions

View File

@ -529,17 +529,24 @@ STATIC
{ {
UINT32 Index; UINT32 Index;
mText = malloc (WNDSIZ * 2 + MAXMATCH); mText = malloc (WNDSIZ * 2 + MAXMATCH);
if (!mText) return EFI_OUT_OF_RESOURCES;
for (Index = 0; Index < WNDSIZ * 2 + MAXMATCH; Index++) { for (Index = 0; Index < WNDSIZ * 2 + MAXMATCH; Index++) {
mText[Index] = 0; mText[Index] = 0;
} }
mLevel = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mLevel)); mLevel = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mLevel));
mChildCount = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mChildCount)); if (!mLevel) return EFI_OUT_OF_RESOURCES;
mPosition = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mPosition)); mChildCount = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mChildCount));
mParent = malloc (WNDSIZ * 2 * sizeof (*mParent)); if (!mChildCount) return EFI_OUT_OF_RESOURCES;
mPrev = malloc (WNDSIZ * 2 * sizeof (*mPrev)); mPosition = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mPosition));
mNext = malloc ((MAX_HASH_VAL + 1) * sizeof (*mNext)); if (!mPosition) return EFI_OUT_OF_RESOURCES;
mParent = malloc (WNDSIZ * 2 * sizeof (*mParent));
if (!mParent) return EFI_OUT_OF_RESOURCES;
mPrev = malloc (WNDSIZ * 2 * sizeof (*mPrev));
if (!mPrev) return EFI_OUT_OF_RESOURCES;
mNext = malloc ((MAX_HASH_VAL + 1) * sizeof (*mNext));
if (!mNext) return EFI_OUT_OF_RESOURCES;
mBufSiz = BLKSIZ; mBufSiz = BLKSIZ;
mBuf = malloc (mBufSiz); mBuf = malloc (mBufSiz);

View File

@ -30,6 +30,8 @@ QString regionTypeToQString(const UINT8 type)
case Subtypes::EcRegion: return QObject::tr("EC"); case Subtypes::EcRegion: return QObject::tr("EC");
case Subtypes::Reserved4Region: return QObject::tr("Reserved4"); case Subtypes::Reserved4Region: return QObject::tr("Reserved4");
}; };
return QObject::tr("Unknown");
} }
QString itemTypeToQString(const UINT8 type) QString itemTypeToQString(const UINT8 type)
@ -59,6 +61,8 @@ QString itemTypeToQString(const UINT8 type)
case Types::Microcode: return QObject::tr("Microcode"); case Types::Microcode: return QObject::tr("Microcode");
case Types::SlicData: return QObject::tr("SLIC data"); case Types::SlicData: return QObject::tr("SLIC data");
} }
return QObject::tr("Unknown");
} }
QString itemSubtypeToQString(const UINT8 type, const UINT8 subtype) QString itemSubtypeToQString(const UINT8 type, const UINT8 subtype)
@ -128,6 +132,8 @@ QString itemSubtypeToQString(const UINT8 type, const UINT8 subtype)
if (subtype == Subtypes::AmdMicrocode) return QObject::tr("AMD"); if (subtype == Subtypes::AmdMicrocode) return QObject::tr("AMD");
break; break;
} }
return QObject::tr("Unknown");
} }
QString compressionTypeToQString(const UINT8 algorithm) QString compressionTypeToQString(const UINT8 algorithm)
@ -141,7 +147,7 @@ QString compressionTypeToQString(const UINT8 algorithm)
case COMPRESSION_ALGORITHM_IMLZMA: return QObject::tr("Intel modified LZMA"); case COMPRESSION_ALGORITHM_IMLZMA: return QObject::tr("Intel modified LZMA");
} }
return QObject::tr("Unknown"); return QObject::tr("Unknown");
} }
QString actionTypeToQString(const UINT8 action) QString actionTypeToQString(const UINT8 action)
@ -155,4 +161,6 @@ QString actionTypeToQString(const UINT8 action)
case Actions::Rebuild: return QObject::tr("Rebuild"); case Actions::Rebuild: return QObject::tr("Rebuild");
case Actions::Rebase: return QObject::tr("Rebase"); case Actions::Rebase: return QObject::tr("Rebase");
} }
return QObject::tr("Unknown");
} }