lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250407-devm-mutex-must-check-v1-1-cf62b440bc33@linaro.org>
Date: Mon, 07 Apr 2025 09:03:46 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
 Will Deacon <will@...nel.org>, Boqun Feng <boqun.feng@...il.com>, 
 Waiman Long <longman@...hat.com>
Cc: linux-kernel@...r.kernel.org, 
 Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: [PATCH] locking/mutex: annotate __devm_mutex_init() with
 __must_check

From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>

Unlike the non-managed mutex_init(), devm_mutex_init() can fail (for
instance: on OOM). Now that we've fixed all instances of users not
checking the return value, annotate it with __must_check to avoid this
problem in the future.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
---
 include/linux/mutex.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 2143d05116be..e194f8c22d72 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -126,7 +126,7 @@ do {							\
 
 #ifdef CONFIG_DEBUG_MUTEXES
 
-int __devm_mutex_init(struct device *dev, struct mutex *lock);
+int __must_check __devm_mutex_init(struct device *dev, struct mutex *lock);
 
 #else
 

---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250326-devm-mutex-must-check-8c1b94ae151f

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ