[U-Boot] [PATCH v2 20/28] tpm: Check that parse_byte_string() has data to parse

Christophe Ricard christophe.ricard at gmail.com
Mon Aug 24 22:22:11 CEST 2015


Hi Simon,

Print an error ? Are you sure ? I guess the comment is not accurate ;).

Best Regards
Christophe

On 23/08/2015 02:31, Simon Glass wrote:
> Rather then crashing when there is no data, print an error.
>
> Acked-by: Christophe Ricard <christophe-h.ricard at st.com>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v2: None
>
>   common/cmd_tpm.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c
> index 65e7371..e9c6618 100644
> --- a/common/cmd_tpm.c
> +++ b/common/cmd_tpm.c
> @@ -58,6 +58,8 @@ static void *parse_byte_string(char *bytes, uint8_t *data, size_t *count_ptr)
>   	size_t count, length;
>   	int i;
>   
> +	if (!bytes)
> +		return NULL;
>   	length = strlen(bytes);
>   	count = length / 2;
>   



More information about the U-Boot mailing list