if (ret != EFI_SUCCESS)
return ret;
- ret = EFI_CALL(efi_search_protocol(&handle->header,
- &efi_guid_loaded_image_device_path,
- &handler));
+ ret = efi_search_protocol(&handle->header,
+ &efi_guid_loaded_image_device_path, &handler);
if (ret != EFI_SUCCESS)
return ret;
- device_path = EFI_CALL(handler->protocol_interface);
+ device_path = handler->protocol_interface;
device_path_length = efi_dp_size(device_path);
if (device_path_length > 0) {
/* add end node size */
device_path_length += sizeof(struct efi_device_path);
}
event_size = sizeof(struct uefi_image_load_event) + device_path_length;
- image_load_event = (struct uefi_image_load_event *)malloc(event_size);
+ image_load_event = calloc(1, event_size);
if (!image_load_event)
return EFI_OUT_OF_RESOURCES;
goto out;
}
- if (device_path_length > 0) {
- memcpy(image_load_event->device_path, device_path,
- device_path_length);
- }
+ /* device_path_length might be zero */
+ memcpy(image_load_event->device_path, device_path, device_path_length);
ret = tcg2_agile_log_append(pcr_index, event_type, &digest_list,
event_size, (u8 *)image_load_event);