Re: [PATCH 14/17] fs/namespace: use __getname() to allocate mntpath buffer
Jan Kara <[email protected]> Mon, 25 May 2026 18:22:13 +0200
| Newsgroups | org.kernel.vger.linux-nilfs,dev.linux.lists.ocfs2-devel,org.kernel.vger.linux-ext4,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-nfs,org.kvack.linux-mm |
|---|---|
| Message-ID | <lwnrjpmzbv6swapmnmb5jki3xxxzqsxuks5vykniwhakvhqh7i@rhff3qrwfnoj> |
On Sat 23-05-26 20:54:26, Mike Rapoport (Microsoft) wrote: > 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(). > > Signed-off-by: Mike Rapoport (Microsoft) <[email protected]> > --- > fs/namespace.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/namespace.c b/fs/namespace.c > index fe919abd2f01..2ed9cd846a81 100644 > --- a/fs/namespace.c > +++ b/fs/namespace.c > @@ -3303,7 +3303,7 @@ 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(); Fair but d_path() below should then get PATH_MAX and not PAGE_SIZE. > if (buf) > mntpath = d_path(mountpoint, buf, PAGE_SIZE); > else > @@ -3319,7 +3319,7 @@ static void mnt_warn_timestamp_expiry(const struct path *mountpoint, > > sb->s_iflags |= SB_I_TS_EXPIRY_WARNED; > if (buf) > - free_page((unsigned long)buf); > + __putname(buf); And __putname() is fine with NULL so no need for the if (buf) check here. Honza -- Jan Kara <[email protected]> SUSE Labs, CR