Thread (2 messages) 2 messages, 2 authors, 2026-06-23

Re: [PATCH] apparmor: mv get_loaddata_common_ref() into CONFIG_SECURITY_APPARMOR_EXPORT_BINARY block

From: John Johansen <john.johansen@canonical.com>
Date: 2026-06-23 07:28:27
Also in: lkml

On 6/22/26 18:50, yaolu@kylinos.cn wrote:
From: Lu Yao <redacted>

When SECURITY_APPARMOR_EXPORT_BINARY is not set, the compiler emits an
unused-function warning which is promoted to an error with -Werror:
   security/apparmor/apparmorfs.c:177:28: error: ‘get_loaddata_common_ref’ defined but not used [-Werror=unused-function]

Move the function into the #ifdef block to match its only call site,
silencing the warning.

Fixes: 8e135b8aee5a ("apparmor: fix race between freeing data and fs accessing it")
Reported-by: k2ci <redacted>
Signed-off-by: Lu Yao <redacted>
the patch is fine but this was already fixed by

d62d9bfe050f4 security/apparmor/apparmorfs.c: conditionally compile get_loaddata_common_ref()

that is queued up in apparmor-next, that was just adding a simple ifdef wrapper, if you want
to rework/rebase your patch to move the fn, and drop the extra ifdef, I have no objections
to pulling it in

quoted hunk ↗ jump to hunk
---
  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 *))
  {
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help