public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Qianqiang Liu <qianqiang.liu@163.com>, namhyung@kernel.org
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Qianqiang Liu <qianqiang.liu@163.com>,
	alexander.shishkin@linux.intel.com
Subject: Re: [PATCH] perf/x86/intel/pt: Fix NULL pointer dereference in pt_buffer_reset_markers
Date: Thu, 24 Oct 2024 14:16:06 +0300	[thread overview]
Message-ID: <87bjz9vjih.fsf@ubik.fi.intel.com> (raw)
In-Reply-To: <20241001082757.111385-2-qianqiang.liu@163.com>

Qianqiang Liu <qianqiang.liu@163.com> writes:

> The buf->stop_te and buf->intr_te may be NULL, so we need to check
> for NULL pointers before using them.

Iirc, this has come up before, because static analyzers get the idea
that at that point ->stop_te and ->intr_te can be NULL, but in reality,
they can't. When the buffer is created, stop_pos and intr_pos are set to
-1, which will always force ->stop_te and ->intr_te to be set the first
time around.

So no, not a bug. It might deserve a comment explaining the above logic,
so that more versions of this patch don't get generated from static
analyzers' reports.

Regards,
--
Alex

  reply	other threads:[~2024-10-24 11:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01  8:27 [PATCH] perf/x86/intel/pt: Fix NULL pointer dereference in pt_buffer_reset_markers Qianqiang Liu
2024-10-24 11:16 ` Alexander Shishkin [this message]
2024-10-25  6:17   ` Qianqiang Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bjz9vjih.fsf@ubik.fi.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=qianqiang.liu@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox