Skip to content

Commit 795d673

Browse files
author
Al Viro
committed
audit_compare_dname_path(): switch to const struct qstr *
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 6921d4e commit 795d673

5 files changed

Lines changed: 8 additions & 9 deletions

File tree

kernel/audit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ extern int audit_comparator(const u32 left, const u32 op, const u32 right);
231231
extern int audit_uid_comparator(kuid_t left, u32 op, kuid_t right);
232232
extern int audit_gid_comparator(kgid_t left, u32 op, kgid_t right);
233233
extern int parent_len(const char *path);
234-
extern int audit_compare_dname_path(const char *dname, const char *path, int plen);
234+
extern int audit_compare_dname_path(const struct qstr *dname, const char *path, int plen);
235235
extern struct sk_buff *audit_make_reply(int seq, int type, int done, int multi,
236236
const void *payload, int size);
237237
extern void audit_panic(const char *message);

kernel/audit_fsnotify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static int audit_mark_handle_event(struct fsnotify_group *group,
188188
}
189189

190190
if (mask & (FS_CREATE|FS_MOVED_TO|FS_DELETE|FS_MOVED_FROM)) {
191-
if (audit_compare_dname_path(dname->name, audit_mark->path, AUDIT_NAME_FULL))
191+
if (audit_compare_dname_path(dname, audit_mark->path, AUDIT_NAME_FULL))
192192
return 0;
193193
audit_update_mark(audit_mark, inode);
194194
} else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))

kernel/audit_watch.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,12 @@ static void audit_update_watch(struct audit_parent *parent,
261261
struct audit_watch *owatch, *nwatch, *nextw;
262262
struct audit_krule *r, *nextr;
263263
struct audit_entry *oentry, *nentry;
264-
const unsigned char *name = dname->name;
265264

266265
mutex_lock(&audit_filter_mutex);
267266
/* Run all of the watches on this parent looking for the one that
268267
* matches the given dname */
269268
list_for_each_entry_safe(owatch, nextw, &parent->watches, wlist) {
270-
if (audit_compare_dname_path(name, owatch->path,
269+
if (audit_compare_dname_path(dname, owatch->path,
271270
AUDIT_NAME_FULL))
272271
continue;
273272

kernel/auditfilter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,12 +1290,12 @@ int parent_len(const char *path)
12901290
* @parentlen: length of the parent if known. Passing in AUDIT_NAME_FULL
12911291
* here indicates that we must compute this value.
12921292
*/
1293-
int audit_compare_dname_path(const char *dname, const char *path, int parentlen)
1293+
int audit_compare_dname_path(const struct qstr *dname, const char *path, int parentlen)
12941294
{
12951295
int dlen, pathlen;
12961296
const char *p;
12971297

1298-
dlen = strlen(dname);
1298+
dlen = dname->len;
12991299
pathlen = strlen(path);
13001300
if (pathlen < dlen)
13011301
return 1;
@@ -1306,7 +1306,7 @@ int audit_compare_dname_path(const char *dname, const char *path, int parentlen)
13061306

13071307
p = path + parentlen;
13081308

1309-
return strncmp(p, dname, dlen);
1309+
return strncmp(p, dname->name, dlen);
13101310
}
13111311

13121312
int audit_filter(int msgtype, unsigned int listtype)

kernel/auditsc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,7 +2045,7 @@ void __audit_inode_child(struct inode *parent,
20452045
{
20462046
struct audit_context *context = audit_context();
20472047
struct inode *inode = d_backing_inode(dentry);
2048-
const char *dname = dentry->d_name.name;
2048+
const struct qstr *dname = &dentry->d_name;
20492049
struct audit_names *n, *found_parent = NULL, *found_child = NULL;
20502050
struct audit_entry *e;
20512051
struct list_head *list = &audit_filter_list[AUDIT_FILTER_FS];
@@ -2099,7 +2099,7 @@ void __audit_inode_child(struct inode *parent,
20992099
(n->type != type && n->type != AUDIT_TYPE_UNKNOWN))
21002100
continue;
21012101

2102-
if (!strcmp(dname, n->name->name) ||
2102+
if (!strcmp(dname->name, n->name->name) ||
21032103
!audit_compare_dname_path(dname, n->name->name,
21042104
found_parent ?
21052105
found_parent->name_len :

0 commit comments

Comments
 (0)