From: Jonathan Gray Date: Sun, 12 Mar 2017 19:26:07 +1100 Subject: [U-Boot] [PATCH 2/2] efi_loader: check CreateEvent() parameters In-Reply-To: <20170312082607.58540-1-jsg@jsg.id.au> References: <20170312082607.58540-1-jsg@jsg.id.au> Message-ID: <20170312082607.58540-2-jsg@jsg.id.au> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add some of the invalid parameter checks described in the UEFI specification for CreateEvent(). This does not include checking the validity of the type and tpl parameters. Signed-off-by: Jonathan Gray --- lib/efi_loader/efi_boottime.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index eb5946a959..7172b690a5 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -189,6 +189,16 @@ static efi_status_t EFIAPI efi_create_event( return EFI_EXIT(EFI_OUT_OF_RESOURCES); } + if (event == NULL) + return EFI_EXIT(EFI_INVALID_PARAMETER); + + if ((type & EVT_NOTIFY_SIGNAL) && (type & EVT_NOTIFY_WAIT)) + return EFI_EXIT(EFI_INVALID_PARAMETER); + + if ((type & (EVT_NOTIFY_SIGNAL|EVT_NOTIFY_WAIT)) && + notify_function == NULL) + return EFI_EXIT(EFI_INVALID_PARAMETER); + efi_event.type = type; efi_event.notify_tpl = notify_tpl; efi_event.notify_function = notify_function; -- 2.12.0