[PATCH net-next v3] af_unix: Fix undefined 'other' error
From: Purva Yeshi
Date: Tue Feb 18 2025 - 09:12:56 EST
Fix an issue detected by the Smatch 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 Smatch warning. 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.
Signed-off-by: Purva Yeshi <purvayeshi550@xxxxxxxxx>
---
V1 - https://lore.kernel.org/lkml/20250209184355.16257-1-purvayeshi550@xxxxxxxxx/
V2 - https://lore.kernel.org/all/20250212104845.2396abcf@xxxxxxxxxx/
V3 - Remove trailing double spaces.
net/unix/af_unix.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 34945de1f..319153850 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1508,7 +1508,6 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
}
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;
--
2.34.1