]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
af_unix: Fix undefined 'other' error
authorPurva Yeshi <purvayeshi550@gmail.com>
Tue, 18 Feb 2025 14:10:45 +0000 (19:40 +0530)
committerJakub Kicinski <kuba@kernel.org>
Thu, 20 Feb 2025 23:28:46 +0000 (15:28 -0800)
Fix an issue with the sparse static analysis tool where an
"undefined 'other'" error occurs due to `__releases(&unix_sk(other)->lock)`
being placed before 'other' is in scope.

Remove the `__releases()` annotation from the `unix_wait_for_peer()`
function to eliminate the sparse error. The annotation references `other`
before it is declared, leading to a false positive error during static
analysis.

Since AF_UNIX does not use sparse annotations, this annotation is
unnecessary and does not impact functionality.

Reviewed-by: Joe Damato <jdamato@fastly.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250218141045.38947-1-purvayeshi550@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/unix/af_unix.c

index 34945de1fb1fa3de21c1aa863852699aa2fb83f1..319153850be18dd5f10b4cd1ea9d79832d1b9685 100644 (file)
@@ -1508,7 +1508,6 @@ out:
 }
 
 static long unix_wait_for_peer(struct sock *other, long timeo)
-       __releases(&unix_sk(other)->lock)
 {
        struct unix_sock *u = unix_sk(other);
        int sched;