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.
Showing the changes to include/linux/timerqueue.h (1 of 1 file). Show all
Unified · Split
| @@ -35,7 +35,7 @@ struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head) · 34 unmodified lines | ||
| 35 | 35 | { |
| 36 | 36 | struct rb_node *leftmost = rb_first_cached(&head->rb_root); |
| 37 | 37 | |
| 38 | − return rb_entry(leftmost, struct timerqueue_node, node); | |
| 38 | + return rb_entry_safe(leftmost, struct timerqueue_node, node); | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | static inline void timerqueue_init(struct timerqueue_node *node) |