[Pdbg] [PATCH] probe: Validate target class

Alistair Popple alistair at popple.id.au
Thu Jul 12 15:00:09 AEST 2018


Thanks Vasant,

Looks to me to be the correct fix. The class gets filled in by matching
device-tree compatible properties, however I think it should be acceptable to
have device-tree entries which either don't match or don't have a valid class.

In your case I believe it was crashing because POWER9 NHTM support was removed
but not the corresponding device-tree entry. Hence there are device-tree entries
which need to be skipped because they don't match, and this is your patch does -
so thanks!

- Alistair

On Thursday, 5 July 2018 8:10:57 PM AEST Vasant Hegde wrote:
> Make sure target class is not NULL before comparision.
> 
> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
> ---
> Note that this fixes Segfault issue. But I'm not sure why we endedup
> having target->class = NULL. We may have real bug somehwere else in
> the code.
> 
> -Vasant
> 
>  src/main.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/main.c b/src/main.c
> index f89db2f..4c6b7fb 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -648,6 +648,10 @@ void print_target(struct pdbg_target *target, int level)
>  
>  	if (target) {
>  		char c = 0;
> +
> +		if (!pdbg_target_class_name(target))
> +			return;
> +
>  		if (!strcmp(pdbg_target_class_name(target), "pib"))
>  			c = 'p';
>  		else if (!strcmp(pdbg_target_class_name(target), "core"))
> 




More information about the Pdbg mailing list