lkml.org 
[lkml]   [2022]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v1] timerqueue: use rb_entry_safe() in timerqueue_getnext()
Date
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

\
 
 \ /
  Last update: 2022-11-14 20:17    [W:0.047 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site