Message ID | 20210326172753.620342-1-colin.king@canonical.com |
---|---|
State | New |
Headers | show |
Series | UBUNTU: SAUCE: apparmor: Fix build error, make sk parameter const | expand |
Forgot to mention, this is for Hirsute On 26/03/2021 17:27, 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> > --- > 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 e2e759b21e44..f379aec0f7e6 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) >
On 26/03/2021 18:27, 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> > --- > 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 e2e759b21e44..f379aec0f7e6 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) Makes sense for the build warning/error but no difference for compiler since the only purpose of unix_sk() is to drop the const :). It's also weird that unix_sk() uses strict ordering of members instead of using container_of(). Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > { > struct unix_sock *u = unix_sk(sk); > if (u && u->addr) > Best regards, Krzysztof
On 26.03.21 18:27, 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> > --- > 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 e2e759b21e44..f379aec0f7e6 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) > Please send again with hirsute mentioned in the subject of at least either the cover email (or like in this case) the patch. -Stefan
On 3/26/21 12:49 PM, Krzysztof Kozlowski wrote: > On 26/03/2021 18:27, 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> >> --- >> 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 e2e759b21e44..f379aec0f7e6 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) > > Makes sense for the build warning/error but no difference for compiler > since the only purpose of unix_sk() is to drop the const :). It's also well it does the typecast too > weird that unix_sk() uses strict ordering of members instead of using > container_of(). > unix_sk is old, I wouldn't be surprised if it predates container_of Acked-by: John Johansen <john.johansen@canonical.com> > Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > >> { >> struct unix_sock *u = unix_sk(sk); >> if (u && u->addr) >> > > > Best regards, > Krzysztof >
diff --git a/security/apparmor/net.c b/security/apparmor/net.c index e2e759b21e44..f379aec0f7e6 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)