* [PATCH] apparmor: remove useless static inline functions
@ 2022-09-26 2:28 Gaosheng Cui
2022-10-02 11:35 ` John Johansen
0 siblings, 1 reply; 2+ messages in thread
From: Gaosheng Cui @ 2022-09-26 2:28 UTC (permalink / raw)
To: john.johansen, paul, jmorris, serge, cuigaosheng1
Cc: apparmor, linux-security-module
Remove the following useless static inline functions:
1. label_is_visible() is a static function in
security/apparmor/label.c, and it's not used, aa_ns_visible()
can do the same things as it, so it's redundant.
2. is_deleted() is a static function in security/apparmor/file.c,
and it's not used since commit aebd873e8d3e ("apparmor: refactor
path name lookup and permission checks around labels"), so it's
redundant.
They are redundant, so remove them.
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
security/apparmor/file.c | 13 -------------
security/apparmor/label.c | 6 ------
2 files changed, 19 deletions(-)
diff --git a/security/apparmor/file.c b/security/apparmor/file.c
index e1b7e93602e4..ee43c48b9c3f 100644
--- a/security/apparmor/file.c
+++ b/security/apparmor/file.c
@@ -141,19 +141,6 @@ int aa_audit_file(struct aa_profile *profile, struct aa_perms *perms,
return aa_audit(type, profile, &sa, file_audit_cb);
}
-/**
- * is_deleted - test if a file has been completely unlinked
- * @dentry: dentry of file to test for deletion (NOT NULL)
- *
- * Returns: true if deleted else false
- */
-static inline bool is_deleted(struct dentry *dentry)
-{
- if (d_unlinked(dentry) && d_backing_inode(dentry)->i_nlink == 0)
- return true;
- return false;
-}
-
static int path_name(const char *op, struct aa_label *label,
const struct path *path, int flags, char *buffer,
const char **name, struct path_cond *cond, u32 request)
diff --git a/security/apparmor/label.c b/security/apparmor/label.c
index 0f36ee907438..cd2d0242df91 100644
--- a/security/apparmor/label.c
+++ b/security/apparmor/label.c
@@ -1254,12 +1254,6 @@ struct aa_label *aa_label_merge(struct aa_label *a, struct aa_label *b,
return label;
}
-static inline bool label_is_visible(struct aa_profile *profile,
- struct aa_label *label)
-{
- return aa_ns_visible(profile->ns, labels_ns(label), true);
-}
-
/* match a profile and its associated ns component if needed
* Assumes visibility test has already been done.
* If a subns profile is not to be matched should be prescreened with
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] apparmor: remove useless static inline functions
2022-09-26 2:28 [PATCH] apparmor: remove useless static inline functions Gaosheng Cui
@ 2022-10-02 11:35 ` John Johansen
0 siblings, 0 replies; 2+ messages in thread
From: John Johansen @ 2022-10-02 11:35 UTC (permalink / raw)
To: Gaosheng Cui, paul, jmorris, serge; +Cc: apparmor, linux-security-module
On 9/25/22 19:28, Gaosheng Cui wrote:
> Remove the following useless static inline functions:
>
> 1. label_is_visible() is a static function in
> security/apparmor/label.c, and it's not used, aa_ns_visible()
> can do the same things as it, so it's redundant.
>
> 2. is_deleted() is a static function in security/apparmor/file.c,
> and it's not used since commit aebd873e8d3e ("apparmor: refactor
> path name lookup and permission checks around labels"), so it's
> redundant.
>
> They are redundant, so remove them.
>
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Acked-by: John.johansen@canonical.com
I have pulled this into my tree
> ---
> security/apparmor/file.c | 13 -------------
> security/apparmor/label.c | 6 ------
> 2 files changed, 19 deletions(-)
>
> diff --git a/security/apparmor/file.c b/security/apparmor/file.c
> index e1b7e93602e4..ee43c48b9c3f 100644
> --- a/security/apparmor/file.c
> +++ b/security/apparmor/file.c
> @@ -141,19 +141,6 @@ int aa_audit_file(struct aa_profile *profile, struct aa_perms *perms,
> return aa_audit(type, profile, &sa, file_audit_cb);
> }
>
> -/**
> - * is_deleted - test if a file has been completely unlinked
> - * @dentry: dentry of file to test for deletion (NOT NULL)
> - *
> - * Returns: true if deleted else false
> - */
> -static inline bool is_deleted(struct dentry *dentry)
> -{
> - if (d_unlinked(dentry) && d_backing_inode(dentry)->i_nlink == 0)
> - return true;
> - return false;
> -}
> -
> static int path_name(const char *op, struct aa_label *label,
> const struct path *path, int flags, char *buffer,
> const char **name, struct path_cond *cond, u32 request)
> diff --git a/security/apparmor/label.c b/security/apparmor/label.c
> index 0f36ee907438..cd2d0242df91 100644
> --- a/security/apparmor/label.c
> +++ b/security/apparmor/label.c
> @@ -1254,12 +1254,6 @@ struct aa_label *aa_label_merge(struct aa_label *a, struct aa_label *b,
> return label;
> }
>
> -static inline bool label_is_visible(struct aa_profile *profile,
> - struct aa_label *label)
> -{
> - return aa_ns_visible(profile->ns, labels_ns(label), true);
> -}
> -
> /* match a profile and its associated ns component if needed
> * Assumes visibility test has already been done.
> * If a subns profile is not to be matched should be prescreened with
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-02 11:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 2:28 [PATCH] apparmor: remove useless static inline functions Gaosheng Cui
2022-10-02 11:35 ` John Johansen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.