afs: Use kfree_rcu() instead of casting kfree() to rcu_callback_t
PATCH 1/1 afs: Use kfree_rcu() instead of casting kfree() to rcu_callback_t
afs_put_addrlist() casts kfree() to rcu_callback_t. Apart from being wrong in theory, this might also blow up when people start enforcing function types via compiler instrumentation, and it means the rcu_head has to be first in struct afs_addr_list.
Use kfree_rcu() instead, it's simpler and more correct.
Signed-off-by Jann Horn <[email protected]>
---
compile-tested only
fs/afs/addr_list.c | 2 +- fs/afs/internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/afs/addr_list.c +1 -1
@@ -19,7 +19,7 @@void afs_put_addrlist (struct afs_addr_list *alist) {if (alist &&refcount_dec_and_test (&alist->usage)) -call_rcu (&alist->rcu, (rcu_callback_t )kfree); +kfree_rcu (alist, rcu); }/*
fs/afs/internal.h +1 -1
@@ -81,7 +81,7 @@ enum afs_call_state {* List of server addresses. */ struct afs_addr_list { -struct rcu_head rcu;/* Must be first */ +struct rcu_head rcu;refcount_t usage;u32 version;/* Version */ unsigned char max_addrs;
base-commit: aeb542a1b5c507ea117d21c3e3e012ba16f065ac
Signature · 1 line
2.25.0.265.gbab2e86ba0-goog