From: Purva Yeshi <purvayeshi550@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: skhan@linuxfoundation.org, horms@kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
purvayeshi550@gmail.com
Subject: [PATCH] net: unix: Fix undefined 'other' error
Date: Mon, 10 Feb 2025 00:13:55 +0530 [thread overview]
Message-ID: <20250209184355.16257-1-purvayeshi550@gmail.com> (raw)
Fix issue detected by smatch tool:
An "undefined 'other'" error occur in __releases() annotation.
The issue occurs because __releases(&unix_sk(other)->lock) is placed
at the function signature level, where other is not yet in scope.
Fix this by replacing it with __releases(&u->lock), using u, a local
variable, which is properly defined inside the function.
Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
---
net/unix/af_unix.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 34945de1f..37b01605a 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1508,7 +1508,10 @@ 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)
+ /*
+ * Use local variable instead of function parameter
+ */
+ __releases(&u->lock)
{
struct unix_sock *u = unix_sk(other);
int sched;
--
2.34.1
next reply other threads:[~2025-02-09 18:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-09 18:43 Purva Yeshi [this message]
2025-02-10 0:26 ` [PATCH] net: unix: Fix undefined 'other' error Kuniyuki Iwashima
2025-02-10 7:45 ` Purva Yeshi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250209184355.16257-1-purvayeshi550@gmail.com \
--to=purvayeshi550@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox