mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
fs/namespace: use __getname() to allocate mntpath buffer
mnt_warn_timestamp_expiry() allocates memory for a path with __get_free_page() although there is a dedicated helper for allocation of file paths: __getname(). Replace __get_free_page() for allocation of a path buffer with __getname(). Christian Brauner <brauner@kernel.org> says: Pass PATH_MAX (not PAGE_SIZE) to d_path() to match the size that __getname() actually allocates, and drop the now-unnecessary NULL check around __putname() since __putname() handles NULL. Both per Jan Kara's review feedback, acked by the author. Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Link: https://patch.msgid.link/20260523-b4-fs-v1-14-275e36a83f0e@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
parent
cf080236f3
commit
aca4fd395d
|
|
@ -3303,9 +3303,9 @@ static void mnt_warn_timestamp_expiry(const struct path *mountpoint,
|
|||
(ktime_get_real_seconds() + TIME_UPTIME_SEC_MAX > sb->s_time_max)) {
|
||||
char *buf, *mntpath;
|
||||
|
||||
buf = (char *)__get_free_page(GFP_KERNEL);
|
||||
buf = __getname();
|
||||
if (buf)
|
||||
mntpath = d_path(mountpoint, buf, PAGE_SIZE);
|
||||
mntpath = d_path(mountpoint, buf, PATH_MAX);
|
||||
else
|
||||
mntpath = ERR_PTR(-ENOMEM);
|
||||
if (IS_ERR(mntpath))
|
||||
|
|
@ -3318,8 +3318,7 @@ static void mnt_warn_timestamp_expiry(const struct path *mountpoint,
|
|||
(unsigned long long)sb->s_time_max);
|
||||
|
||||
sb->s_iflags |= SB_I_TS_EXPIRY_WARNED;
|
||||
if (buf)
|
||||
free_page((unsigned long)buf);
|
||||
__putname(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user