Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

eCryptfs: Use DEFINE_MUTEX() for mutex lock

mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Tyler Hicks <code@tyhicks.com>

authored by

Ye Bin and committed by
Tyler Hicks
724fa862 ffbed072

+2 -4
+2 -4
fs/ecryptfs/messaging.c
··· 14 14 15 15 static LIST_HEAD(ecryptfs_msg_ctx_free_list); 16 16 static LIST_HEAD(ecryptfs_msg_ctx_alloc_list); 17 - static struct mutex ecryptfs_msg_ctx_lists_mux; 17 + static DEFINE_MUTEX(ecryptfs_msg_ctx_lists_mux); 18 18 19 19 static struct hlist_head *ecryptfs_daemon_hash; 20 - struct mutex ecryptfs_daemon_hash_mux; 20 + DEFINE_MUTEX(ecryptfs_daemon_hash_mux); 21 21 static int ecryptfs_hash_bits; 22 22 #define ecryptfs_current_euid_hash(uid) \ 23 23 hash_long((unsigned long)from_kuid(&init_user_ns, current_euid()), ecryptfs_hash_bits) ··· 361 361 "too large, defaulting to [%d] users\n", __func__, 362 362 ecryptfs_number_of_users); 363 363 } 364 - mutex_init(&ecryptfs_daemon_hash_mux); 365 364 mutex_lock(&ecryptfs_daemon_hash_mux); 366 365 ecryptfs_hash_bits = 1; 367 366 while (ecryptfs_number_of_users >> ecryptfs_hash_bits) ··· 384 385 rc = -ENOMEM; 385 386 goto out; 386 387 } 387 - mutex_init(&ecryptfs_msg_ctx_lists_mux); 388 388 mutex_lock(&ecryptfs_msg_ctx_lists_mux); 389 389 ecryptfs_msg_counter = 0; 390 390 for (i = 0; i < ecryptfs_message_buf_len; i++) {