ImageTool: Remove argument asserts

This commit is contained in:
Marvin Häuser 2023-06-13 01:31:48 +02:00 committed by MikhailKrichanov
parent f374c858df
commit 78703654d8
6 changed files with 0 additions and 72 deletions

View File

@ -19,9 +19,6 @@ CreateEntry (
EFI_IMAGE_RESOURCE_DIRECTORY *RDir;
EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *Entry;
assert (HiiSectionHeader != NULL);
assert (HiiSectionOffset != NULL);
RDir = (EFI_IMAGE_RESOURCE_DIRECTORY *)(HiiSectionHeader + *HiiSectionOffset);
*HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY);
RDir->NumberOfNamedEntries = 1;
@ -49,11 +46,6 @@ CreateStringEntry (
{
EFI_IMAGE_RESOURCE_DIRECTORY_STRING *RDStr;
assert (Entry != NULL);
assert (HiiSectionHeader != NULL);
assert (HiiSectionOffset != NULL);
assert (String != NULL);
Entry->u1.s.NameOffset = *HiiSectionOffset;
RDStr = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *)(HiiSectionHeader + *HiiSectionOffset);
RDStr->Length = (UINT16)StrLen (String);
@ -78,8 +70,6 @@ InitializeHiiResouceSectionHeader (
EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *LangRDirEntry;
EFI_IMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry;
assert (HiiSectionHeader != NULL);
HiiSectionOffset = 0;
//
// Create Type, Name, Language entries
@ -123,10 +113,6 @@ ConstructHii (
UINT32 FileSize;
UINT8 NumberOfFormPackages;
assert (Hii != NULL);
assert (HiiGuid != NULL);
assert (FileNames != NULL);
NumberOfFormPackages = 0;
EndPackage.Length = sizeof (EFI_HII_PACKAGE_HEADER);

View File

@ -103,8 +103,6 @@ IsShdrLoadable (
IN const Elf_Shdr *Shdr
)
{
assert (Shdr != NULL);
return (Shdr->sh_flags & SHF_ALLOC) != 0;
}
@ -662,7 +660,6 @@ ScanElf (
const Elf_Ehdr *Ehdr;
Elf_Addr BaseAddress;
assert (ImageInfo != NULL);
assert (File != NULL || FileSize == 0);
Status = ParseElfFile (&Context, File, FileSize);

View File

@ -16,9 +16,6 @@ CheckToolImageSegment (
{
bool Overflow;
assert (Segment != NULL);
assert (PreviousEndAddress != NULL);
if (!IS_ALIGNED (Segment->ImageSize, SegmentInfo->SegmentAlignment)) {
DEBUG_RAISE ();
return false;
@ -58,9 +55,6 @@ CheckToolImageSegmentInfo (
uint32_t Index;
bool Result;
assert (SegmentInfo != NULL);
assert (ImageSize != NULL);
if (!IS_POW2 (SegmentInfo->SegmentAlignment)) {
DEBUG_RAISE ();
return false;
@ -123,9 +117,6 @@ ImageGetSegmentByAddress (
{
uint32_t Index;
assert (Address != NULL);
assert (SegmentInfo != NULL);
for (Index = 0; Index < SegmentInfo->NumSegments; ++Index) {
if ((SegmentInfo->Segments[Index].ImageAddress <= *Address)
&& (*Address < SegmentInfo->Segments[Index].ImageAddress + SegmentInfo->Segments[Index].ImageSize)) {
@ -181,9 +172,6 @@ CheckToolImageReloc (
uint16_t MovHigh;
uint16_t MovLow;
assert (Image != NULL);
assert (Reloc != NULL);
RelocOffset = Reloc->Target;
Segment = ImageGetSegmentByAddress (
&RelocOffset,
@ -245,8 +233,6 @@ CheckToolImageRelocInfo (
uint32_t Index;
bool Result;
assert (Image != NULL);
RelocInfo = &Image->RelocInfo;
if (RelocInfo->NumRelocs == 0) {
@ -289,8 +275,6 @@ CheckToolImageDebugInfo (
const image_tool_debug_info_t *DebugInfo
)
{
assert (DebugInfo != NULL);
if (DebugInfo->SymbolsPath != NULL) {
// FIXME: UE-only?
if (DebugInfo->SymbolsPathLen > MAX_UINT8) {
@ -310,8 +294,6 @@ CheckToolImage (
bool Result;
uint32_t ImageSize;
assert (Image != NULL);
Result = CheckToolImageSegmentInfo (&Image->SegmentInfo, &ImageSize);
if (!Result) {
DEBUG_RAISE ();
@ -370,8 +352,6 @@ ToolImageDestruct (
{
uint8_t Index;
assert (Image != NULL);
if (Image->SegmentInfo.Segments != NULL) {
for (Index = 0; Index < Image->SegmentInfo.NumSegments; ++Index) {
free (Image->SegmentInfo.Segments[Index].Name);

View File

@ -37,10 +37,6 @@ HiiSrc (
FILE *FilePtr;
UINT32 Index;
assert (FileNames != NULL);
assert (HiiName != NULL);
assert (Guid != NULL);
Status = AsciiStrToGuid (Guid, &HiiGuid);
if (RETURN_ERROR (Status)) {
fprintf (stderr, "ImageTool: Invalid GUID - %s\n", Guid);
@ -247,9 +243,6 @@ GetAcpi (
UINT16 Index;
UINT32 FileLength;
assert (PeName != NULL);
assert (AcpiName != NULL);
Pe = UserReadFile (PeName, &PeSize);
if (Pe == NULL) {
fprintf (stderr, "ImageTool: Could not open %s: %s\n", PeName, strerror (errno));

View File

@ -30,9 +30,6 @@ ScanPeGetRelocInfo (
UINT16 RelocType;
UINT16 RelocOffset;
assert (RelocInfo != NULL);
assert (Context != NULL);
// FIXME: PE/COFF context access
RelocBlockRva = Context->RelocDirRva;
RelocDirSize = Context->RelocDirSize;
@ -158,9 +155,6 @@ ScanPeGetSegmentInfo (
const char *ImageBuffer;
uint32_t Index;
assert (SegmentInfo != NULL);
assert (Context != NULL);
NumSections = PeCoffGetSectionTable (Context, &Section);
SegmentInfo->Segments = calloc (NumSections, sizeof (*SegmentInfo->Segments));
@ -229,9 +223,6 @@ ScanPeGetDebugInfo (
UINT32 PdbPathSize;
RETURN_STATUS Status;
assert (DebugInfo != NULL);
assert (Context != NULL);
Status = PeCoffGetPdbPath (Context, &PdbPath, &PdbPathSize);
if (Status == RETURN_NOT_FOUND) {
return true;
@ -268,9 +259,6 @@ ScanPeGetHiiInfo (
RETURN_STATUS Status;
const char *ImageBuffer;
assert (HiiInfo != NULL);
assert (Context != NULL);
Status = PeCoffGetHiiDataRva (Context, &HiiRva, &HiiSize);
if (Status == RETURN_NOT_FOUND) {
return true;

View File

@ -21,9 +21,6 @@ ScanUefiImageGetHeaderInfo (
RETURN_STATUS Status;
UINT64 Address;
assert (HeaderInfo != NULL);
assert (Context != NULL);
HeaderInfo->BaseAddress = UefiImageGetPreferredAddress (Context);
HeaderInfo->EntryPointAddress = UefiImageGetEntryPointAddress (Context);
HeaderInfo->Machine = UefiImageGetMachine (Context);
@ -56,9 +53,6 @@ ScanUefiImageGetRelocInfo (
{
UINT8 FormatIndex;
assert (RelocInfo != NULL);
assert (Context != NULL);
FormatIndex = UefiImageGetFormat (Context);
RelocInfo->RelocsStripped = UefiImageGetRelocsStripped (Context);
@ -84,9 +78,6 @@ ScanUefiImageGetSegmentInfo (
{
UINT8 FormatIndex;
assert (SegmentInfo != NULL);
assert (Context != NULL);
FormatIndex = UefiImageGetFormat (Context);
SegmentInfo->SegmentAlignment = UefiImageGetSegmentAlignment (Context);
@ -113,9 +104,6 @@ ScanUefiImageGetDebugInfo (
const CHAR8 *SymbolsPath;
UINT32 SymbolsPathSize;
assert (DebugInfo != NULL);
assert (Context != NULL);
Status = UefiImageGetSymbolsPath (Context, &SymbolsPath, &SymbolsPathSize);
if (Status == RETURN_NOT_FOUND || Status == RETURN_UNSUPPORTED) {
return true;
@ -152,9 +140,6 @@ ScanUefiImageGetHiiInfo (
UINT32 HiiSize;
const char *ImageBuffer;
assert (HiiInfo != NULL);
assert (Context != NULL);
Status = UefiImageGetHiiDataRva (Context, &HiiRva, &HiiSize);
if (Status == RETURN_NOT_FOUND) {
return true;
@ -195,7 +180,6 @@ ToolContextConstructUefiImage (
void *Destination;
bool Success;
assert (Image != NULL);
assert (File != NULL || FileSize == 0);
if (FileSize > MAX_UINT32) {