public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Petr Mladek <pmladek@suse.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH next] netfilter: nf_conntrack_h323: Correct indentation when H323_TRACE defined
Date: Thu, 26 Mar 2026 22:18:09 +0000	[thread overview]
Message-ID: <20260326221809.0b99df3f@pumpkin> (raw)
In-Reply-To: <acWWBxmPd_BNqUHF@chamomile>

On Thu, 26 Mar 2026 21:24:39 +0100
Pablo Neira Ayuso <pablo@netfilter.org> wrote:

> Hi David,
> 
> On Thu, Mar 26, 2026 at 08:18:19PM +0000, 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.  
> 
> Do you have a setup using this helper? Or you just found this via
> visual inspection?

Found with grep looking for places which might be affected by 'fixing'
the kernel printf code to be POSIX compliant.

	David

> 
> > 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;
> >  }
> > @@ -284,7 +284,7 @@ static int decode_nul(struct bitstr *bs, const struct field_t *f,
> >  static int decode_bool(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);
> >  
> >  	INC_BIT(bs);
> >  	if (nf_h323_error_boundary(bs, 0, 0))
> > @@ -297,7 +297,7 @@ static int decode_oid(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	int len;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	BYTE_ALIGN(bs);
> >  	if (nf_h323_error_boundary(bs, 1, 0))
> > @@ -316,7 +316,7 @@ static int decode_int(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s", level * TAB_SIZE, " ", f->name);
> >  
> >  	switch (f->sz) {
> >  	case BYTE:		/* Range == 256 */
> > @@ -363,7 +363,7 @@ static int decode_int(struct bitstr *bs, const struct field_t *f,
> >  static int decode_enum(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);
> >  
> >  	if ((f->attr & EXT) && get_bit(bs)) {
> >  		INC_BITS(bs, 7);
> > @@ -381,7 +381,7 @@ static int decode_bitstr(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	BYTE_ALIGN(bs);
> >  	switch (f->sz) {
> > @@ -417,7 +417,7 @@ static int decode_numstr(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	/* 2 <= Range <= 255 */
> >  	if (nf_h323_error_boundary(bs, 0, f->sz))
> > @@ -437,7 +437,7 @@ static int decode_octstr(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s", level * TAB_SIZE, " ", f->name);
> >  
> >  	switch (f->sz) {
> >  	case FIXD:		/* Range == 1 */
> > @@ -490,7 +490,7 @@ static int decode_bmpstr(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	switch (f->sz) {
> >  	case BYTE:		/* Range == 256 */
> > @@ -522,7 +522,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  	const struct field_t *son;
> >  	unsigned char *beg = NULL;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	/* Decode? */
> >  	base = (base && (f->attr & DECODE)) ? base + f->offset : NULL;
> > @@ -544,7 +544,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  	/* Decode the root components */
> >  	for (i = opt = 0, son = f->fields; i < f->lb; i++, son++) {
> >  		if (son->attr & STOP) {
> > -			PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
> > +			PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ",
> >  			      son->name);
> >  			return H323_ERROR_STOP;
> >  		}
> > @@ -562,7 +562,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  			if (nf_h323_error_boundary(bs, len, 0))
> >  				return H323_ERROR_BOUND;
> >  			if (!base || !(son->attr & DECODE)) {
> > -				PRINT("%*.s%s\n", (level + 1) * TAB_SIZE,
> > +				PRINT("%*s%s\n", (level + 1) * TAB_SIZE,
> >  				      " ", son->name);
> >  				bs->cur += len;
> >  				continue;
> > @@ -615,7 +615,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  		}
> >  
> >  		if (son->attr & STOP) {
> > -			PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
> > +			PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ",
> >  			      son->name);
> >  			return H323_ERROR_STOP;
> >  		}
> > @@ -629,7 +629,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  		if (nf_h323_error_boundary(bs, len, 0))
> >  			return H323_ERROR_BOUND;
> >  		if (!base || !(son->attr & DECODE)) {
> > -			PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
> > +			PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ",
> >  			      son->name);
> >  			bs->cur += len;
> >  			continue;
> > @@ -655,7 +655,7 @@ static int decode_seqof(struct bitstr *bs, const struct field_t *f,
> >  	const struct field_t *son;
> >  	unsigned char *beg = NULL;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	/* Decode? */
> >  	base = (base && (f->attr & DECODE)) ? base + f->offset : NULL;
> > @@ -710,7 +710,7 @@ static int decode_seqof(struct bitstr *bs, const struct field_t *f,
> >  			if (nf_h323_error_boundary(bs, len, 0))
> >  				return H323_ERROR_BOUND;
> >  			if (!base || !(son->attr & DECODE)) {
> > -				PRINT("%*.s%s\n", (level + 1) * TAB_SIZE,
> > +				PRINT("%*s%s\n", (level + 1) * TAB_SIZE,
> >  				      " ", son->name);
> >  				bs->cur += len;
> >  				continue;
> > @@ -751,7 +751,7 @@ static int decode_choice(struct bitstr *bs, const struct field_t *f,
> >  	const struct field_t *son;
> >  	unsigned char *beg = NULL;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	/* Decode? */
> >  	base = (base && (f->attr & DECODE)) ? base + f->offset : NULL;
> > @@ -792,7 +792,7 @@ static int decode_choice(struct bitstr *bs, const struct field_t *f,
> >  	/* Transfer to son level */
> >  	son = &f->fields[type];
> >  	if (son->attr & STOP) {
> > -		PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ", son->name);
> > +		PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ", son->name);
> >  		return H323_ERROR_STOP;
> >  	}
> >  
> > @@ -804,7 +804,7 @@ static int decode_choice(struct bitstr *bs, const struct field_t *f,
> >  		if (nf_h323_error_boundary(bs, len, 0))
> >  			return H323_ERROR_BOUND;
> >  		if (!base || !(son->attr & DECODE)) {
> > -			PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
> > +			PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ",
> >  			      son->name);
> >  			bs->cur += len;
> >  			return H323_ERROR_NONE;
> > -- 
> > 2.39.5
> >   


      reply	other threads:[~2026-03-26 22:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 20:18 [PATCH next] netfilter: nf_conntrack_h323: Correct indentation when H323_TRACE defined david.laight.linux
2026-03-26 20:24 ` Pablo Neira Ayuso
2026-03-26 22:18   ` David Laight [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260326221809.0b99df3f@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox