public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Barnabás Pőcze" <pobrn@protonmail.com>
Cc: linux-kernel@vger.kernel.org, John Stultz <jstultz@google.com>
Subject: Re: [PATCH v1] timerqueue: use rb_entry_safe() in timerqueue_getnext()
Date: Mon, 14 Nov 2022 20:16:24 +0100	[thread overview]
Message-ID: <878rkds5x3.ffs@tglx> (raw)
In-Reply-To: <BNP2PqwI58CzAxJejDx9BcX2nWxSOo-hoZ1qh_7ZrmvqcNwz49RCBxZscYZCoHTlG7bqz2V12bhc5r88dPKopRgoy_XxO4QypcWoRFe3fMI=@protonmail.com>

On Mon, Nov 14 2022 at 15:54, Barnabás Pőcze wrote:
> 2022. november 14., hétfő 1:17 keltezéssel, Thomas Gleixner írta:
>> On Thu, Oct 27 2022 at 21:37, Barnabás Pőcze wrote:
>
>   When `timerqueue_getnext()` is called on an empty timer queue, it will
>   use `rb_entry()` on a NULL pointer, which is invalid. Fix that by using
>   `rb_entry_safe()` which handles NULL pointers.
>   
>   This has not caused any issues so far because the offset of the `rb_node`
>   member in `timerqueue_node` is 0, so `rb_entry()` is essentially a
>   no-op.

Yes. Very precise and informative.

>> Back then when that code got introduced rb_entry_safe() did not exist at
>> all so it's even more obvious that this is simply a missing NULL pointer
>> check, right?
>
> As far as I can tell it did exist and it was actually used
> when the offending change was committed (511885d7061e).

Hmm. I must have messed up when searching in the history.

Thanks,

        tglx

      reply	other threads:[~2022-11-14 19:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 21:37 [PATCH v1] timerqueue: use rb_entry_safe() in timerqueue_getnext() Barnabás Pőcze
2022-11-14  0:17 ` Thomas Gleixner
2022-11-14 15:54   ` Barnabás Pőcze
2022-11-14 19:16     ` Thomas Gleixner [this message]

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=878rkds5x3.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pobrn@protonmail.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