diff mbox series

ceph: exchange hardcoded value on NAME_MAX

Message ID 20250124194623.19699-1-slava@dubeyko.com (mailing list archive)
State New
Headers show
Series ceph: exchange hardcoded value on NAME_MAX | expand

Commit Message

Viacheslav Dubeyko Jan. 24, 2025, 7:46 p.m. UTC
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>

Initially, ceph_fs_debugfs_init() had temporary
name buffer with hardcoded length of 80 symbols.
Then, it was hardcoded again for 100 symbols.
Finally, it makes sense to exchange hardcoded
value on properly defined constant and 255 symbols
should be enough for any name case.

Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
---
 fs/ceph/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Patrick Donnelly Jan. 24, 2025, 8:51 p.m. UTC | #1
On Fri, Jan 24, 2025 at 2:46 PM Viacheslav Dubeyko <slava@dubeyko.com> wrote:
>
> From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
>
> Initially, ceph_fs_debugfs_init() had temporary
> name buffer with hardcoded length of 80 symbols.
> Then, it was hardcoded again for 100 symbols.
> Finally, it makes sense to exchange hardcoded
> value on properly defined constant and 255 symbols
> should be enough for any name case.
>
> Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
> ---
>  fs/ceph/debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
> index fdf9dc15eafa..fdd404fc8112 100644
> --- a/fs/ceph/debugfs.c
> +++ b/fs/ceph/debugfs.c
> @@ -412,7 +412,7 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
>
>  void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
>  {
> -       char name[100];
> +       char name[NAME_MAX];
>
>         doutc(fsc->client, "begin\n");
>         fsc->debugfs_congestion_kb =
> --
> 2.48.0
>
>

Reviewed-by: Patrick Donnelly <pdonnell@ibm.com>
Ilya Dryomov Jan. 27, 2025, 3:14 p.m. UTC | #2
On Fri, Jan 24, 2025 at 9:51 PM Patrick Donnelly <pdonnell@redhat.com> wrote:
>
> On Fri, Jan 24, 2025 at 2:46 PM Viacheslav Dubeyko <slava@dubeyko.com> wrote:
> >
> > From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
> >
> > Initially, ceph_fs_debugfs_init() had temporary
> > name buffer with hardcoded length of 80 symbols.
> > Then, it was hardcoded again for 100 symbols.
> > Finally, it makes sense to exchange hardcoded
> > value on properly defined constant and 255 symbols
> > should be enough for any name case.
> >
> > Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
> > ---
> >  fs/ceph/debugfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
> > index fdf9dc15eafa..fdd404fc8112 100644
> > --- a/fs/ceph/debugfs.c
> > +++ b/fs/ceph/debugfs.c
> > @@ -412,7 +412,7 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
> >
> >  void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
> >  {
> > -       char name[100];
> > +       char name[NAME_MAX];
> >
> >         doutc(fsc->client, "begin\n");
> >         fsc->debugfs_congestion_kb =
> > --
> > 2.48.0
> >
> >
>
> Reviewed-by: Patrick Donnelly <pdonnell@ibm.com>

Applied.

Thanks,

                Ilya
diff mbox series

Patch

diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index fdf9dc15eafa..fdd404fc8112 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -412,7 +412,7 @@  void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
 
 void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
 {
-	char name[100];
+	char name[NAME_MAX];
 
 	doutc(fsc->client, "begin\n");
 	fsc->debugfs_congestion_kb =