Re: [PATCH next] netfilter: nf_conntrack_h323: Correct indentation when H323_TRACE defined

Petr Mladek
2026-03-27T13:11:27Z

On Fri 2026-03-27 12:55:27, David Laight wrote:
> On Fri, 27 Mar 2026 10:47:41 +0100
> Petr Mladek <pmladek@suse.com> wrote:
>
> > On Thu 2026-03-26 20:18:19, david.laight.linux@gmail.com wrote:
> > > From: David Laight <david.laight.linux@gmail.com>
> > >
> > > The trace lines are indented using PRINT("%*.s", xx, " ").
> > > Userspace will treat this as "%*.0s" and will output no characters
> > > when 'xx' is zero, the kernel treats it as "%*s" and will output
> > > a single ' ' - which is probably what is intended.
> > >
> > > Change all the formats to "%*s" removing the default precision.
> > > This gives a single space indent when level is zero.
> > >
> > > Signed-off-by: David Laight <david.laight.linux@gmail.com>
> > > ---
> > > net/netfilter/nf_conntrack_h323_asn1.c | 38 +++++++++++++-------------
> > > 1 file changed, 19 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c
> > > index 7b1497ed97d2..287402428975 100644
> > > --- a/net/netfilter/nf_conntrack_h323_asn1.c
> > > +++ b/net/netfilter/nf_conntrack_h323_asn1.c
> > > @@ -276,7 +276,7 @@ static unsigned int get_uint(struct bitstr *bs, int b)
> > > static int decode_nul(struct bitstr *bs, const struct field_t *f,
> > > char *base, int level)
> > > {
> > > - PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > > + PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> > >
> > > return H323_ERROR_NONE;
> > > }
> >
> > The change is important for making the kernel %*.s handling POSIX
> > compliant. The dot '.' without any following number is handled
> > a zero precision by POSIX. It would print no space "" when
> > also the field width was zero, aka when level == 0.
> >
> > It has no efect if the field width (@level) is always > 0 because
> > vsprintf() would add the required emptry spaces ' ' anyway.
>
> That looks like C&P AI output...

I believe that these days AI would be able to formulate it a much better
way than me.

Best Regards,
Petr