Re: [PATCH] Add pointer check

From: Alexander Shishkin
Date: Mon Sep 20 2021 - 06:42:36 EST


cgel.zte@xxxxxxxxx writes:

> From: Yang Guang <yang.guang5@xxxxxxxxxx>
>
> The buf->stop_te pointer may be NULL.

[...]

> --- a/arch/x86/events/intel/pt.c
> +++ b/arch/x86/events/intel/pt.c
> @@ -1118,9 +1118,12 @@ static int pt_buffer_reset_markers(struct pt_buffer *buf,
> buf->intr_te = pt_topa_prev_entry(buf, buf->intr_te);
> }
>
> - buf->stop_te->stop = 1;
> - buf->stop_te->intr = 1;
> - buf->intr_te->intr = 1;
> + if (buf->stop_te) {

It really can't be NULL at this point.

Regards,
--
Alex