[U-Boot] [PATCH 01/11] efi_selftest: avoid dereferencing NULL in tpl test

Simon Glass sjg at chromium.org
Mon Oct 9 04:48:50 UTC 2017


On 7 October 2017 at 22:57, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> The task priority levels test uses two events one passes the
> notification counter as context. The other passes NULL.
> Both use the same notification function. So we need to check
> for NULL here.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  lib/efi_selftest/efi_selftest_tpl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/efi_selftest/efi_selftest_tpl.c b/lib/efi_selftest/efi_selftest_tpl.c
> index 0b78ee7595..b8c0e70262 100644
> --- a/lib/efi_selftest/efi_selftest_tpl.c
> +++ b/lib/efi_selftest/efi_selftest_tpl.c
> @@ -26,7 +26,8 @@ static void EFIAPI notify(struct efi_event *event, void *context)
>  {
>         unsigned int *count = context;

Ick, this should go in a struct.

struct something *ctx = context;

ctx->count++

>
> -       ++*count;
> +       if (count)
> +               ++*count;
>  }
>
>  /*
> --
> 2.14.1
>

Anyway, for this patch:

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list