mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
audit: optimize audit_compare_dname_path
In the cases where we already know the length of the parent, pass it as a parm so we don't need to recompute it. In the cases where we don't know the length, pass in AUDIT_NAME_FULL (-1) to indicate that it should be determined. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
29e9a3467c
commit
e3d6b07b8b
4 changed files with 20 additions and 12 deletions
|
@ -81,9 +81,6 @@
|
|||
* a name dynamically and also add those to the list anchored by names_list. */
|
||||
#define AUDIT_NAMES 5
|
||||
|
||||
/* Indicates that audit should log the full pathname. */
|
||||
#define AUDIT_NAME_FULL -1
|
||||
|
||||
/* no execve audit message should be longer than this (userspace limits) */
|
||||
#define MAX_EXECVE_AUDIT_LEN 7500
|
||||
|
||||
|
@ -2222,7 +2219,7 @@ void __audit_inode_child(const struct inode *parent,
|
|||
continue;
|
||||
|
||||
if (n->ino == parent->i_ino &&
|
||||
!audit_compare_dname_path(dname, n->name)) {
|
||||
!audit_compare_dname_path(dname, n->name, n->name_len)) {
|
||||
found_parent = n->name;
|
||||
goto add_names;
|
||||
}
|
||||
|
@ -2235,7 +2232,8 @@ void __audit_inode_child(const struct inode *parent,
|
|||
|
||||
/* strcmp() is the more likely scenario */
|
||||
if (!strcmp(dname, n->name) ||
|
||||
!audit_compare_dname_path(dname, n->name)) {
|
||||
!audit_compare_dname_path(dname, n->name,
|
||||
AUDIT_NAME_FULL)) {
|
||||
if (inode)
|
||||
audit_copy_inode(n, dentry, inode);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue