[U-Boot] [PATCH v2] tpm: Fix uclass_first_device error handling

Simon Glass sjg at chromium.org
Tue Apr 5 21:09:53 CEST 2016


On 5 April 2016 at 07:15, Mario Six <mario.six at gdsys.cc> wrote:
>
> uclass_first_device might return NULL for the device despite a zero
> return code. Currently, this might lead to null pointer dereferencing,
> since the returned device is not properly checked.
>
> We switch to uclass_first_device_err to make sure that the returned device is
> valid.
>
> Signed-off-by: Mario Six <mario.six at gdsys.cc>
> Cc: Simon Glass <sjg at chromium.org>
> ---
>
> v2:
>  - Use uclass_first_device_err instead of explicit null checking
>
>
>  lib/tpm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Thanks!

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


More information about the U-Boot mailing list