Skip to content

Commit 3e45553

Browse files
nathanchancejrjohansen
authored andcommitted
apparmor: Remove unused variable 'sock' in __file_sock_perm()
When CONFIG_SECURITY_APPARMOR_DEBUG_ASSERTS is disabled, there is a warning that sock is unused: security/apparmor/file.c: In function '__file_sock_perm': security/apparmor/file.c:544:24: warning: unused variable 'sock' [-Wunused-variable] 544 | struct socket *sock = (struct socket *) file->private_data; | ^~~~ sock was moved into aa_sock_file_perm(), where the same check is present, so remove sock and the assertion from __file_sock_perm() to fix the warning. Fixes: c05e705 ("apparmor: add fine grained af_unix mediation") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202501190757.myuLxLyL-lkp@intel.com/ Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent 67e370a commit 3e45553

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

security/apparmor/file.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,8 @@ static int __file_sock_perm(const char *op, const struct cred *subj_cred,
541541
struct aa_label *flabel, struct file *file,
542542
u32 request, u32 denied)
543543
{
544-
struct socket *sock = (struct socket *) file->private_data;
545544
int error;
546545

547-
AA_BUG(!sock);
548-
549546
/* revalidation due to label out of date. No revocation at this time */
550547
if (!denied && aa_label_is_subset(flabel, label))
551548
return 0;

0 commit comments

Comments
 (0)