diff mbox series

[HIRSUTE,RESEND] UBUNTU: SAUCE: apparmor: Fix build error, make sk parameter const

Message ID 20210329092615.83011-1-colin.king@canonical.com
State New
Headers show
Series [HIRSUTE,RESEND] UBUNTU: SAUCE: apparmor: Fix build error, make sk parameter const | expand

Commit Message

Colin Ian King March 29, 2021, 9:26 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Make the sk parameter const to fix a build error with clang:

security/apparmor/net.c:143:35: error: passing 'const struct sock *' to
parameter of type 'struct sock *' discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
                        audit_unix_sk_addr(ab, "addr", sa->u.net->sk);
                                                       ^~~~~~~~~~~~~
/home/ubuntu/hirsute/security/apparmor/net.c:98:24: note: passing argument
to parameter 'sk' here
                               struct sock *sk)
                                            ^

Fixes: 2775e0786896 ("UBUNTU: SAUCE: apparmor: af_unix mediation")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---

V2: Add [HIRSUTE] in $SUBJECT

---
 security/apparmor/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Pisati March 29, 2021, 10:34 a.m. UTC | #1
On Mon, Mar 29, 2021 at 10:26:15AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>

Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Andrea Righi March 29, 2021, 11:22 a.m. UTC | #2
Applied to hirsute/5.11.

Thanks,
-Andrea

On Mon, Mar 29, 2021 at 10:26:15AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Make the sk parameter const to fix a build error with clang:
> 
> security/apparmor/net.c:143:35: error: passing 'const struct sock *' to
> parameter of type 'struct sock *' discards qualifiers
> [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
>                         audit_unix_sk_addr(ab, "addr", sa->u.net->sk);
>                                                        ^~~~~~~~~~~~~
> /home/ubuntu/hirsute/security/apparmor/net.c:98:24: note: passing argument
> to parameter 'sk' here
>                                struct sock *sk)
>                                             ^
> 
> Fixes: 2775e0786896 ("UBUNTU: SAUCE: apparmor: af_unix mediation")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
> 
> V2: Add [HIRSUTE] in $SUBJECT
> 
> ---
>  security/apparmor/net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/apparmor/net.c b/security/apparmor/net.c
> index 297589c6dc95..01e2c6c89b22 100644
> --- a/security/apparmor/net.c
> +++ b/security/apparmor/net.c
> @@ -95,7 +95,7 @@ static void audit_unix_addr(struct audit_buffer *ab, const char *str,
>  }
>  
>  static void audit_unix_sk_addr(struct audit_buffer *ab, const char *str,
> -			       struct sock *sk)
> +			       const struct sock *sk)
>  {
>  	struct unix_sock *u = unix_sk(sk);
>  	if (u && u->addr)
> -- 
> 2.30.2
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/security/apparmor/net.c b/security/apparmor/net.c
index 297589c6dc95..01e2c6c89b22 100644
--- a/security/apparmor/net.c
+++ b/security/apparmor/net.c
@@ -95,7 +95,7 @@  static void audit_unix_addr(struct audit_buffer *ab, const char *str,
 }
 
 static void audit_unix_sk_addr(struct audit_buffer *ab, const char *str,
-			       struct sock *sk)
+			       const struct sock *sk)
 {
 	struct unix_sock *u = unix_sk(sk);
 	if (u && u->addr)