On Wed, Jan 22, 2025 at 08:03:34PM +0000, ser...@kernel.org wrote: > On Wed, Jan 22, 2025 at 07:55:35AM +0100, Arnd Bergmann wrote: > > From: Arnd Bergmann <a...@arndb.de> > > > > 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. > > That's interesting. The aa_sock_file_perm() further in will > still trip the AA_BUG(!sock) if there's some shenanigans going > on so no big loss in dropping the AA_BUG. >
AA_BUG(X, args) extends to AA_BUG_FMT((X), "" args); which is #define AA_BUG_FMT(X, fmt, args...) no_printk(fmt, ##args) if CONFIG_SECURITY_APPARMOR_DEBUG_ASSERTS=n. That means the first parameter is dropped and sock is indeed unused in that case. Guenter