Skip to content

Commit b42ffcd

Browse files
author
Al Viro
committed
collect_paths(): constify the return value
callers have no business modifying the paths they get Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 1f6df58 commit b42ffcd

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

fs/namespace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,7 +2300,7 @@ static inline bool extend_array(struct path **res, struct path **to_free,
23002300
return p;
23012301
}
23022302

2303-
struct path *collect_paths(const struct path *path,
2303+
const struct path *collect_paths(const struct path *path,
23042304
struct path *prealloc, unsigned count)
23052305
{
23062306
struct mount *root = real_mount(path->mnt);
@@ -2334,7 +2334,7 @@ struct path *collect_paths(const struct path *path,
23342334
return res;
23352335
}
23362336

2337-
void drop_collected_paths(const struct path *paths, struct path *prealloc)
2337+
void drop_collected_paths(const struct path *paths, const struct path *prealloc)
23382338
{
23392339
for (const struct path *p = paths; p->mnt; p++)
23402340
path_put(p);

include/linux/mount.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ extern int may_umount_tree(struct vfsmount *);
104104
extern int may_umount(struct vfsmount *);
105105
int do_mount(const char *, const char __user *,
106106
const char *, unsigned long, void *);
107-
extern struct path *collect_paths(const struct path *, struct path *, unsigned);
108-
extern void drop_collected_paths(const struct path *, struct path *);
107+
extern const struct path *collect_paths(const struct path *, struct path *, unsigned);
108+
extern void drop_collected_paths(const struct path *, const struct path *);
109109
extern void kern_unmount_array(struct vfsmount *mnt[], unsigned int num);
110110

111111
extern int cifs_root_data(char **dev, char **opts);

0 commit comments

Comments
 (0)