Re: [PATCH] apparmor: remove unused variable

From: John Johansen
Date: Fri Jan 24 2025 - 18:47:01 EST


On 1/21/25 22:55, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@xxxxxxxx>

The local 'sock' variable has become unused after a change to the
aa_sock_file_perm() calling conventions:

security/apparmor/file.c: In function '__file_sock_perm':
security/apparmor/file.c:544:24: error: unused variable 'sock' [-Werror=unused-variable]
544 | struct socket *sock = (struct socket *) file->private_data;

Remove it here.

Fixes: c05e705812d1 ("apparmor: add fine grained af_unix mediation")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

yeah, unfortunately Nathan beat you by a few hours with
[PATCH] apparmor: remove unused variable

and since I am walking the backlog in time order I pulled his version of the patch.

All the same thanks for taking the time to fix this, it is much appreciated

john

---
security/apparmor/file.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/security/apparmor/file.c b/security/apparmor/file.c
index 85f89814af1e..e3a858649942 100644
--- a/security/apparmor/file.c
+++ b/security/apparmor/file.c
@@ -541,11 +541,8 @@ static int __file_sock_perm(const char *op, const struct cred *subj_cred,
struct aa_label *flabel, struct file *file,
u32 request, u32 denied)
{
- struct socket *sock = (struct socket *) file->private_data;
int error;
- AA_BUG(!sock);
-
/* revalidation due to label out of date. No revocation at this time */
if (!denied && aa_label_is_subset(flabel, label))
return 0;