* [PATCH] apparmor: hide unused get_loaddata_common_ref() function
@ 2026-03-16 13:59 Arnd Bergmann
2026-03-16 15:27 ` Serge E. Hallyn
2026-03-18 6:33 ` John Johansen
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-03-16 13:59 UTC (permalink / raw)
To: John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
Maxime Bélair, Cengiz Can, Georgia Garcia
Cc: Arnd Bergmann, Christian Brauner, Jeff Layton, NeilBrown,
apparmor, linux-security-module, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The newly introduced function is only used in an #ifdef block,
which causes a harmless warning:
security/apparmor/apparmorfs.c:177:28: error: 'get_loaddata_common_ref' defined but not used [-Werror=unused-function]
177 | static struct aa_loaddata *get_loaddata_common_ref(struct aa_common_ref *ref)
Move the definition next to the user to avoid the warning.
Fixes: 8e135b8aee5a ("apparmor: fix race between freeing data and fs accessing it")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Alternatively, the #ifdef checks could be replaced with an
'if(IS_ENABLED(CONFIG_SECURITY_APPARMOR_EXPORT_BINARY) return;'
check in __aa_fs_create_rawdata(), relying on the compiler's
dead code elimination.
---
security/apparmor/apparmorfs.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index ededaf46f3ca..f762b101d682 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -174,14 +174,6 @@ static struct aa_proxy *get_proxy_common_ref(struct aa_common_ref *ref)
return NULL;
}
-static struct aa_loaddata *get_loaddata_common_ref(struct aa_common_ref *ref)
-{
- if (ref)
- return aa_get_i_loaddata(container_of(ref, struct aa_loaddata,
- count));
- return NULL;
-}
-
static void aa_put_common_ref(struct aa_common_ref *ref)
{
if (!ref)
@@ -1318,6 +1310,14 @@ static const struct file_operations seq_rawdata_ ##NAME ##_fops = { \
.release = seq_rawdata_release, \
} \
+static struct aa_loaddata *get_loaddata_common_ref(struct aa_common_ref *ref)
+{
+ if (ref)
+ return aa_get_i_loaddata(container_of(ref, struct aa_loaddata,
+ count));
+ return NULL;
+}
+
static int seq_rawdata_open(struct inode *inode, struct file *file,
int (*show)(struct seq_file *, void *))
{
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] apparmor: hide unused get_loaddata_common_ref() function
2026-03-16 13:59 [PATCH] apparmor: hide unused get_loaddata_common_ref() function Arnd Bergmann
@ 2026-03-16 15:27 ` Serge E. Hallyn
2026-03-18 6:33 ` John Johansen
1 sibling, 0 replies; 3+ messages in thread
From: Serge E. Hallyn @ 2026-03-16 15:27 UTC (permalink / raw)
To: Arnd Bergmann
Cc: John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
Maxime Bélair, Cengiz Can, Georgia Garcia, Arnd Bergmann,
Christian Brauner, Jeff Layton, NeilBrown, apparmor,
linux-security-module, linux-kernel
On Mon, Mar 16, 2026 at 02:59:31PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly introduced function is only used in an #ifdef block,
> which causes a harmless warning:
>
> security/apparmor/apparmorfs.c:177:28: error: 'get_loaddata_common_ref' defined but not used [-Werror=unused-function]
> 177 | static struct aa_loaddata *get_loaddata_common_ref(struct aa_common_ref *ref)
>
> Move the definition next to the user to avoid the warning.
>
> Fixes: 8e135b8aee5a ("apparmor: fix race between freeing data and fs accessing it")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
> ---
> Alternatively, the #ifdef checks could be replaced with an
> 'if(IS_ENABLED(CONFIG_SECURITY_APPARMOR_EXPORT_BINARY) return;'
> check in __aa_fs_create_rawdata(), relying on the compiler's
> dead code elimination.
> ---
> security/apparmor/apparmorfs.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index ededaf46f3ca..f762b101d682 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -174,14 +174,6 @@ static struct aa_proxy *get_proxy_common_ref(struct aa_common_ref *ref)
> return NULL;
> }
>
> -static struct aa_loaddata *get_loaddata_common_ref(struct aa_common_ref *ref)
> -{
> - if (ref)
> - return aa_get_i_loaddata(container_of(ref, struct aa_loaddata,
> - count));
> - return NULL;
> -}
> -
> static void aa_put_common_ref(struct aa_common_ref *ref)
> {
> if (!ref)
> @@ -1318,6 +1310,14 @@ static const struct file_operations seq_rawdata_ ##NAME ##_fops = { \
> .release = seq_rawdata_release, \
> } \
>
> +static struct aa_loaddata *get_loaddata_common_ref(struct aa_common_ref *ref)
> +{
> + if (ref)
> + return aa_get_i_loaddata(container_of(ref, struct aa_loaddata,
> + count));
> + return NULL;
> +}
> +
> static int seq_rawdata_open(struct inode *inode, struct file *file,
> int (*show)(struct seq_file *, void *))
> {
> --
> 2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] apparmor: hide unused get_loaddata_common_ref() function
2026-03-16 13:59 [PATCH] apparmor: hide unused get_loaddata_common_ref() function Arnd Bergmann
2026-03-16 15:27 ` Serge E. Hallyn
@ 2026-03-18 6:33 ` John Johansen
1 sibling, 0 replies; 3+ messages in thread
From: John Johansen @ 2026-03-18 6:33 UTC (permalink / raw)
To: Arnd Bergmann, Paul Moore, James Morris, Serge E. Hallyn,
Maxime Bélair, Cengiz Can, Georgia Garcia
Cc: Arnd Bergmann, Christian Brauner, Jeff Layton, NeilBrown,
apparmor, linux-security-module, linux-kernel
On 3/16/26 06:59, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly introduced function is only used in an #ifdef block,
> which causes a harmless warning:
>
> security/apparmor/apparmorfs.c:177:28: error: 'get_loaddata_common_ref' defined but not used [-Werror=unused-function]
> 177 | static struct aa_loaddata *get_loaddata_common_ref(struct aa_common_ref *ref)
>
> Move the definition next to the user to avoid the warning.
>
> Fixes: 8e135b8aee5a ("apparmor: fix race between freeing data and fs accessing it")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: John Johansen <john.johansen@canonical.com>
this has now been pulled into my tree
> ---
> Alternatively, the #ifdef checks could be replaced with an
> 'if(IS_ENABLED(CONFIG_SECURITY_APPARMOR_EXPORT_BINARY) return;'
> check in __aa_fs_create_rawdata(), relying on the compiler's
> dead code elimination.
> ---
> security/apparmor/apparmorfs.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index ededaf46f3ca..f762b101d682 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -174,14 +174,6 @@ static struct aa_proxy *get_proxy_common_ref(struct aa_common_ref *ref)
> return NULL;
> }
>
> -static struct aa_loaddata *get_loaddata_common_ref(struct aa_common_ref *ref)
> -{
> - if (ref)
> - return aa_get_i_loaddata(container_of(ref, struct aa_loaddata,
> - count));
> - return NULL;
> -}
> -
> static void aa_put_common_ref(struct aa_common_ref *ref)
> {
> if (!ref)
> @@ -1318,6 +1310,14 @@ static const struct file_operations seq_rawdata_ ##NAME ##_fops = { \
> .release = seq_rawdata_release, \
> } \
>
> +static struct aa_loaddata *get_loaddata_common_ref(struct aa_common_ref *ref)
> +{
> + if (ref)
> + return aa_get_i_loaddata(container_of(ref, struct aa_loaddata,
> + count));
> + return NULL;
> +}
> +
> static int seq_rawdata_open(struct inode *inode, struct file *file,
> int (*show)(struct seq_file *, void *))
> {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-18 6:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 13:59 [PATCH] apparmor: hide unused get_loaddata_common_ref() function Arnd Bergmann
2026-03-16 15:27 ` Serge E. Hallyn
2026-03-18 6:33 ` John Johansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox