} u;
unsigned int i;
+ /* Sanity check */
+ if ( ! guid )
+ return NULL;
+
/* Check for a match against well-known GUIDs */
for ( i = 0 ; i < ( sizeof ( efi_well_known_guids ) /
sizeof ( efi_well_known_guids[0] ) ) ; i++ ) {
EFI_STATUS efirc;
int rc;
+ /* Sanity check */
+ if ( ( ! handle ) || ( ! protocol ) ) {
+ printf ( "EFI could not retrieve openers for %s on %p\n",
+ efi_guid_ntoa ( protocol ), handle );
+ return;
+ }
+
/* Retrieve list of openers */
if ( ( efirc = bs->OpenProtocolInformation ( handle, protocol, &openers,
&count ) ) != 0 ) {
EFI_STATUS efirc;
int rc;
+ /* Sanity check */
+ if ( ! handle ) {
+ printf ( "EFI could not retrieve protocols for %p\n", handle );
+ return;
+ }
+
/* Retrieve list of protocols */
if ( ( efirc = bs->ProtocolsPerHandle ( handle, &protocols,
&count ) ) != 0 ) {
static char text[256];
CHAR16 *wtext;
- /* Convert path to a textual representation */
- if ( ! efidpt )
+ /* Sanity checks */
+ if ( ! efidpt ) {
+ DBG ( "[No DevicePathToText]" );
+ return NULL;
+ }
+ if ( ! path ) {
+ DBG ( "[NULL DevicePath]" );
return NULL;
+ }
+
+ /* Convert path to a textual representation */
wtext = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
if ( ! wtext )
return NULL;
CHAR16 *driver_name;
EFI_STATUS efirc;
+ /* Sanity check */
+ if ( ! wtf ) {
+ DBG ( "[NULL ComponentName2]" );
+ return NULL;
+ }
+
/* Try "en" first; if that fails then try the first language */
if ( ( ( efirc = wtf->GetDriverName ( wtf, "en",
&driver_name ) ) != 0 ) &&
static const char *
efi_pecoff_debug_name ( EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
static char buf[32];
- EFI_IMAGE_DOS_HEADER *dos = loaded->ImageBase;
+ EFI_IMAGE_DOS_HEADER *dos;
EFI_IMAGE_OPTIONAL_HEADER_UNION *pe;
EFI_IMAGE_OPTIONAL_HEADER32 *opt32;
EFI_IMAGE_OPTIONAL_HEADER64 *opt64;
char *name;
char *tmp;
+ /* Sanity check */
+ if ( ! loaded ) {
+ DBG ( "[NULL LoadedImage]" );
+ return NULL;
+ }
+
/* Parse DOS header */
+ dos = loaded->ImageBase;
if ( ! dos ) {
DBG ( "[Missing DOS header]" );
return NULL;
static const char *
efi_first_loaded_image_name ( EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
+ /* Sanity check */
+ if ( ! loaded ) {
+ DBG ( "[NULL LoadedImage]" );
+ return NULL;
+ }
+
return ( ( loaded->ParentHandle == NULL ) ? "DxeCore(?)" : NULL );
}
static const char *
efi_loaded_image_filepath_name ( EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
+ /* Sanity check */
+ if ( ! loaded ) {
+ DBG ( "[NULL LoadedImage]" );
+ return NULL;
+ }
+
return efi_devpath_text ( loaded->FilePath );
}