netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3] af_unix: Fix undefined 'other' error
@ 2025-02-18 14:10 Purva Yeshi
  2025-02-18 18:39 ` Kuniyuki Iwashima
  2025-02-21  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Purva Yeshi @ 2025-02-18 14:10 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: skhan, Simon Horman, netdev, linux-kernel, Purva Yeshi

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@gmail.com>
---
V1 - https://lore.kernel.org/lkml/20250209184355.16257-1-purvayeshi550@gmail.com/
V2 - https://lore.kernel.org/all/20250212104845.2396abcf@kernel.org/
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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v3] af_unix: Fix undefined 'other' error
  2025-02-18 14:10 [PATCH net-next v3] af_unix: Fix undefined 'other' error Purva Yeshi
@ 2025-02-18 18:39 ` Kuniyuki Iwashima
  2025-02-21  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2025-02-18 18:39 UTC (permalink / raw)
  To: purvayeshi550
  Cc: davem, edumazet, horms, kuba, linux-kernel, netdev, pabeni, skhan,
	Kuniyuki Iwashima

From: Purva Yeshi <purvayeshi550@gmail.com>
Date: Tue, 18 Feb 2025 19:40:45 +0530
> 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.

I don't care much, but according to Dan, this is Sparse error due to
const unix_sk() ?

https://lore.kernel.org/all/bbf51850-814a-4a30-8165-625d88f221a5@stanley.mountain/

> 
> Remove the `__releases()` annotation from the `unix_wait_for_peer()`
> function to eliminate the Smatch warning. The annotation references `other`

Same here ?


> 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@gmail.com>

Anyway,

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>

Also, I think you can carry over Joe and Simon's tags as the change is
trivial.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v3] af_unix: Fix undefined 'other' error
  2025-02-18 14:10 [PATCH net-next v3] af_unix: Fix undefined 'other' error Purva Yeshi
  2025-02-18 18:39 ` Kuniyuki Iwashima
@ 2025-02-21  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-21  1:30 UTC (permalink / raw)
  To: Purva Yeshi
  Cc: davem, edumazet, kuba, pabeni, skhan, horms, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 18 Feb 2025 19:40:45 +0530 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v3] af_unix: Fix undefined 'other' error
    https://git.kernel.org/netdev/net-next/c/1340461e5168

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-21  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-18 14:10 [PATCH net-next v3] af_unix: Fix undefined 'other' error Purva Yeshi
2025-02-18 18:39 ` Kuniyuki Iwashima
2025-02-21  1:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).