[PATCH 2/4] rtmutex: Use waiter debug init,free magic numbers
From: Davidlohr Bueso
Date: Mon Apr 04 2016 - 02:34:02 EST
... we already use these for regular mutexes, rtmutex can
also use it, and while at it rename the whole thing since
this is specific to waiters.
Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx>
---
include/linux/poison.h | 4 ++--
kernel/locking/mutex-debug.c | 4 ++--
kernel/locking/rtmutex-debug.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 4a27153574e2..f6c413f9d8f6 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -74,8 +74,8 @@
#define ATM_POISON 0xdeadbeef
/********** kernel/mutexes **********/
-#define MUTEX_DEBUG_INIT 0x11
-#define MUTEX_DEBUG_FREE 0x22
+#define MUTEX_WAITER_DEBUG_INIT 0x11
+#define MUTEX_WAITER_DEBUG_FREE 0x22
/********** lib/flex_array.c **********/
#define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */
diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c
index 3ef3736002d8..cd7539c88a8a 100644
--- a/kernel/locking/mutex-debug.c
+++ b/kernel/locking/mutex-debug.c
@@ -29,7 +29,7 @@
*/
void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
{
- memset(waiter, MUTEX_DEBUG_INIT, sizeof(*waiter));
+ memset(waiter, MUTEX_WAITER_DEBUG_INIT, sizeof(*waiter));
waiter->magic = waiter;
INIT_LIST_HEAD(&waiter->list);
}
@@ -45,7 +45,7 @@ void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter)
void debug_mutex_free_waiter(struct mutex_waiter *waiter)
{
DEBUG_LOCKS_WARN_ON(!list_empty(&waiter->list));
- memset(waiter, MUTEX_DEBUG_FREE, sizeof(*waiter));
+ memset(waiter, MUTEX_WAITER_DEBUG_FREE, sizeof(*waiter));
}
void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
diff --git a/kernel/locking/rtmutex-debug.c b/kernel/locking/rtmutex-debug.c
index 62b6cee8ea7f..4659980d9614 100644
--- a/kernel/locking/rtmutex-debug.c
+++ b/kernel/locking/rtmutex-debug.c
@@ -154,14 +154,14 @@ void debug_rt_mutex_proxy_unlock(struct rt_mutex *lock)
void debug_rt_mutex_init_waiter(struct rt_mutex_waiter *waiter)
{
- memset(waiter, 0x11, sizeof(*waiter));
+ memset(waiter, MUTEX_WAITER_DEBUG_INIT, sizeof(*waiter));
waiter->deadlock_task_pid = NULL;
}
void debug_rt_mutex_free_waiter(struct rt_mutex_waiter *waiter)
{
put_pid(waiter->deadlock_task_pid);
- memset(waiter, 0x22, sizeof(*waiter));
+ memset(waiter, MUTEX_WAITER_DEBUG_FREE, sizeof(*waiter));
}
void debug_rt_mutex_init(struct rt_mutex *lock, const char *name)
--
2.7.4