All of lore.kernel.org
 help / color / mirror / Atom feed
From: sergeh@kernel.org
To: Arnd Bergmann <arnd@kernel.org>
Cc: John Johansen <john.johansen@canonical.com>,
	Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Colin Ian King <colin.i.king@gmail.com>,
	apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] apparmor: remove unused variable
Date: Wed, 22 Jan 2025 20:03:34 +0000	[thread overview]
Message-ID: <Z5FPFhc9w0aemqL_@lei> (raw)
In-Reply-To: <20250122065543.1515519-1-arnd@kernel.org>

On Wed, Jan 22, 2025 at 07:55:35AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@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.

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

Acked-by: Serge Hallyn <serge@hallyn.com>

> ---
>  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;
> -- 
> 2.39.5
> 

  reply	other threads:[~2025-01-22 20:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22  6:55 [PATCH] apparmor: remove unused variable Arnd Bergmann
2025-01-22 20:03 ` sergeh [this message]
2025-01-24 21:02   ` Guenter Roeck
2025-01-24 23:46 ` John Johansen

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=Z5FPFhc9w0aemqL_@lei \
    --to=sergeh@kernel.org \
    --cc=apparmor@lists.ubuntu.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=colin.i.king@gmail.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.