From 7331a67227f3865ed7f60395f6cffd0a07330db7 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 14 Jan 2025 17:13:11 -0500 Subject: [PATCH] kernel/util: Require passing a list_link to list_remove_link. If something other than a list_link is passed, an explicit cast will now be needed. No functional change intended. --- headers/private/kernel/util/list.h | 2 +- src/system/kernel/fs/node_monitor.cpp | 2 +- src/system/kernel/thread.cpp | 2 +- src/system/kernel/util/list.cpp | 4 +--- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/headers/private/kernel/util/list.h b/headers/private/kernel/util/list.h index 5424c10fb6..822be06ac5 100644 --- a/headers/private/kernel/util/list.h +++ b/headers/private/kernel/util/list.h @@ -54,7 +54,7 @@ extern void list_init(struct list *list); extern void list_init_etc(struct list *list, int32 offset); extern void list_add_link_to_head(struct list *list, void *_link); extern void list_add_link_to_tail(struct list *list, void *_link); -extern void list_remove_link(void *_link); +extern void list_remove_link(struct list_link *_link); extern void *list_get_next_item(struct list *list, void *item); extern void *list_get_prev_item(struct list *list, void *item); extern void *list_get_last_item(struct list *list); diff --git a/src/system/kernel/fs/node_monitor.cpp b/src/system/kernel/fs/node_monitor.cpp index a00f7f0d6b..c3a3c95b0f 100644 --- a/src/system/kernel/fs/node_monitor.cpp +++ b/src/system/kernel/fs/node_monitor.cpp @@ -339,7 +339,7 @@ NodeMonitorService::_RemoveListener(monitor_listener *listener) // remove it from the listener and I/O context lists monitor->listeners.Remove(listener); - list_remove_link(listener); + list_remove_link(&listener->context_link); if (dynamic_cast(listener->listener) != NULL) { // This is a listener we copied ourselves in UpdateUserListener(), diff --git a/src/system/kernel/thread.cpp b/src/system/kernel/thread.cpp index 3e201f8b97..53dcd03502 100644 --- a/src/system/kernel/thread.cpp +++ b/src/system/kernel/thread.cpp @@ -2604,7 +2604,7 @@ wait_for_thread_etc(thread_id id, uint32 flags, bigtime_t timeout, // remove our death entry now. thread = Thread::GetAndLock(id); if (thread != NULL) { - list_remove_link(&death); + list_remove_link(&death.link); thread->UnlockAndReleaseReference(); } else { // The thread is already gone, so we need to wait uninterruptibly diff --git a/src/system/kernel/util/list.cpp b/src/system/kernel/util/list.cpp index 266e552aa2..215a249d4e 100644 --- a/src/system/kernel/util/list.cpp +++ b/src/system/kernel/util/list.cpp @@ -81,10 +81,8 @@ list_add_link_to_tail(struct list *list, void *_link) */ void -list_remove_link(void *_link) +list_remove_link(list_link *link) { - list_link *link = (list_link *)_link; - link->next->prev = link->prev; link->prev->next = link->next;