Re: [PATCH next] ext4: Fix diagnostic printf formats
From: Andy Shevchenko
Date: Sun Mar 29 2026 - 07:37:31 EST
On Fri, Mar 27, 2026 at 12:14:14PM -0500, Theodore Tso wrote:
> On Fri, Mar 27, 2026 at 04:12:38PM +0200, Andy Shevchenko wrote:
> > > > I'm not sure how your patch helps with all that, but apparently the
> > > > printed data has to be NUL-terminated, otherwise I have no idea how
> > > > it was ever working without crashes.
> > >
> > > I noticed that as well.
> > > I suspect it way have worked for the person that wrote it because the
> > > name strings all happened to be NUL terminated.
> > > There is certainly likely to be a '\0' before you 'fall off' mapped
> > > memory and crash - so maybe they just ignored the extra characters.
> > >
> > > Clearly the other option is to delete it all.
> >
> > I would go for the history of the change and if it's old enough and not
> > mentioned in any Documentation or not-so-old email thread, kill all that
> > for good. But better to hear the ext4 maintainers first.
>
> This is code that can only be manually enabled by adding a
>
> #define DX_DEBUG
>
> to the sources; it's not anything that users can configure using
> Kconfig. It *has* been used relatively recently, when developers
> added support for three level htree directories. I'm not sure why
> they didn't run into the NULL termination issue, but since it is handy
> to have the debugging code for developers' use, my preference would be
> to keep the code and fix it up the problems.
Good to know!
But what is expected input here, i.o.w. should we assume it's always
NUL-terminated, or use fixed-length strings? If the latter one is correct
the current patch may be applied as is then.
--
With Best Regards,
Andy Shevchenko