]> www.infradead.org Git - users/hch/misc.git/commitdiff
drop_collected_paths(): constify arguments
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 6 Jul 2025 22:45:02 +0000 (18:45 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 16 Sep 2025 01:26:43 +0000 (21:26 -0400)
... and use that to constify the pointers in callers

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c
include/linux/mount.h
kernel/audit_tree.c

index 62cffd3b6de2a925d072d43c90eaf5ef31e3c3d3..346e577073bb49d96c209d249fccd148d1d0c2e4 100644 (file)
@@ -2334,9 +2334,9 @@ struct path *collect_paths(const struct path *path,
        return res;
 }
 
-void drop_collected_paths(struct path *paths, struct path *prealloc)
+void drop_collected_paths(const struct path *paths, struct path *prealloc)
 {
-       for (struct path *p = paths; p->mnt; p++)
+       for (const struct path *p = paths; p->mnt; p++)
                path_put(p);
        if (paths != prealloc)
                kfree(paths);
index 5f9c053b08971a94815ebe8ee23c040a929e2310..c09032463b36ef6603e217d038a782ebb304fd2f 100644 (file)
@@ -105,7 +105,7 @@ extern int may_umount(struct vfsmount *);
 int do_mount(const char *, const char __user *,
                     const char *, unsigned long, void *);
 extern struct path *collect_paths(const struct path *, struct path *, unsigned);
-extern void drop_collected_paths(struct path *, struct path *);
+extern void drop_collected_paths(const struct path *, struct path *);
 extern void kern_unmount_array(struct vfsmount *mnt[], unsigned int num);
 
 extern int cifs_root_data(char **dev, char **opts);
index b0eae2a3c895d80d5c88a73bbfc66a9dcabbb8ff..32007edf0e55187eabd4e18a9ce1ad05d4c119bd 100644 (file)
@@ -678,7 +678,7 @@ void audit_trim_trees(void)
                struct audit_tree *tree;
                struct path path;
                struct audit_node *node;
-               struct path *paths;
+               const struct path *paths;
                struct path array[16];
                int err;
 
@@ -701,7 +701,7 @@ void audit_trim_trees(void)
                        struct audit_chunk *chunk = find_chunk(node);
                        /* this could be NULL if the watch is dying else where... */
                        node->index |= 1U<<31;
-                       for (struct path *p = paths; p->dentry; p++) {
+                       for (const struct path *p = paths; p->dentry; p++) {
                                struct inode *inode = p->dentry->d_inode;
                                if (inode_to_key(inode) == chunk->key) {
                                        node->index &= ~(1U<<31);
@@ -740,9 +740,9 @@ void audit_put_tree(struct audit_tree *tree)
        put_tree(tree);
 }
 
-static int tag_mounts(struct path *paths, struct audit_tree *tree)
+static int tag_mounts(const struct path *paths, struct audit_tree *tree)
 {
-       for (struct path *p = paths; p->dentry; p++) {
+       for (const struct path *p = paths; p->dentry; p++) {
                int err = tag_chunk(p->dentry->d_inode, tree);
                if (err)
                        return err;
@@ -805,7 +805,7 @@ int audit_add_tree_rule(struct audit_krule *rule)
        struct audit_tree *seed = rule->tree, *tree;
        struct path path;
        struct path array[16];
-       struct path *paths;
+       const struct path *paths;
        int err;
 
        rule->tree = NULL;
@@ -877,7 +877,7 @@ int audit_tag_tree(char *old, char *new)
        int failed = 0;
        struct path path1, path2;
        struct path array[16];
-       struct path *paths;
+       const struct path *paths;
        int err;
 
        err = kern_path(new, 0, &path2);