[-next] apparmor: cleanup unused functions in file.h

Message ID 20230725141259.233391-1-xiujianfeng@huawei.com
State New
Headers
Series [-next] apparmor: cleanup unused functions in file.h |

Commit Message

Xiu Jianfeng July 25, 2023, 2:12 p.m. UTC
  After changes in commit 33bf60cabcc7 ("LSM: Infrastructure management of
the file security"), aa_alloc_file_ctx() and aa_free_file_ctx() are no
longer used, so remove them, and also remove aa_get_file_label() because
it seems that it's never been used before.

Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
 security/apparmor/include/file.h | 37 --------------------------------
 1 file changed, 37 deletions(-)
  

Comments

John Johansen Aug. 8, 2023, 8:38 p.m. UTC | #1
On 7/25/23 07:12, Xiu Jianfeng wrote:
> After changes in commit 33bf60cabcc7 ("LSM: Infrastructure management of
> the file security"), aa_alloc_file_ctx() and aa_free_file_ctx() are no
> longer used, so remove them, and also remove aa_get_file_label() because
> it seems that it's never been used before.
> 
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Acked-by: John Johansen <john.johansen@canonical.com>

this has been pulled into apparmor-next

> ---
>   security/apparmor/include/file.h | 37 --------------------------------
>   1 file changed, 37 deletions(-)
> 
> diff --git a/security/apparmor/include/file.h b/security/apparmor/include/file.h
> index 5be620af33ba..23cb6f9dbe6e 100644
> --- a/security/apparmor/include/file.h
> +++ b/security/apparmor/include/file.h
> @@ -45,43 +45,6 @@ struct aa_file_ctx {
>   	u32 allow;
>   };
>   
> -/**
> - * aa_alloc_file_ctx - allocate file_ctx
> - * @label: initial label of task creating the file
> - * @gfp: gfp flags for allocation
> - *
> - * Returns: file_ctx or NULL on failure
> - */
> -static inline struct aa_file_ctx *aa_alloc_file_ctx(struct aa_label *label,
> -						    gfp_t gfp)
> -{
> -	struct aa_file_ctx *ctx;
> -
> -	ctx = kzalloc(sizeof(struct aa_file_ctx), gfp);
> -	if (ctx) {
> -		spin_lock_init(&ctx->lock);
> -		rcu_assign_pointer(ctx->label, aa_get_label(label));
> -	}
> -	return ctx;
> -}
> -
> -/**
> - * aa_free_file_ctx - free a file_ctx
> - * @ctx: file_ctx to free  (MAYBE_NULL)
> - */
> -static inline void aa_free_file_ctx(struct aa_file_ctx *ctx)
> -{
> -	if (ctx) {
> -		aa_put_label(rcu_access_pointer(ctx->label));
> -		kfree_sensitive(ctx);
> -	}
> -}
> -
> -static inline struct aa_label *aa_get_file_label(struct aa_file_ctx *ctx)
> -{
> -	return aa_get_label_rcu(&ctx->label);
> -}
> -
>   /*
>    * The xindex is broken into 3 parts
>    * - index - an index into either the exec name table or the variable table
  

Patch

diff --git a/security/apparmor/include/file.h b/security/apparmor/include/file.h
index 5be620af33ba..23cb6f9dbe6e 100644
--- a/security/apparmor/include/file.h
+++ b/security/apparmor/include/file.h
@@ -45,43 +45,6 @@  struct aa_file_ctx {
 	u32 allow;
 };
 
-/**
- * aa_alloc_file_ctx - allocate file_ctx
- * @label: initial label of task creating the file
- * @gfp: gfp flags for allocation
- *
- * Returns: file_ctx or NULL on failure
- */
-static inline struct aa_file_ctx *aa_alloc_file_ctx(struct aa_label *label,
-						    gfp_t gfp)
-{
-	struct aa_file_ctx *ctx;
-
-	ctx = kzalloc(sizeof(struct aa_file_ctx), gfp);
-	if (ctx) {
-		spin_lock_init(&ctx->lock);
-		rcu_assign_pointer(ctx->label, aa_get_label(label));
-	}
-	return ctx;
-}
-
-/**
- * aa_free_file_ctx - free a file_ctx
- * @ctx: file_ctx to free  (MAYBE_NULL)
- */
-static inline void aa_free_file_ctx(struct aa_file_ctx *ctx)
-{
-	if (ctx) {
-		aa_put_label(rcu_access_pointer(ctx->label));
-		kfree_sensitive(ctx);
-	}
-}
-
-static inline struct aa_label *aa_get_file_label(struct aa_file_ctx *ctx)
-{
-	return aa_get_label_rcu(&ctx->label);
-}
-
 /*
  * The xindex is broken into 3 parts
  * - index - an index into either the exec name table or the variable table