public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Kees Cook <kees@kernel.org>
Cc: Josh Law <objecting@objecting.org>, Jens Axboe <axboe@kernel.dk>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Stefan Haberland <sth@linux.ibm.com>,
	Jan Hoeppner <hoeppner@linux.ibm.com>,
	"Richard Russon (FlatCap)" <ldm@flatcap.org>,
	Thorsten Blum <thorsten.blum@linux.dev>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-efi@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-ntfs-dev@lists.sourceforge.net,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] block: partitions: Replace pp_buf with struct seq_buf
Date: Mon, 23 Mar 2026 17:05:49 +0200	[thread overview]
Message-ID: <acFWzUYlNE2k2aca@ashevche-desk.local> (raw)
In-Reply-To: <acD_IIEXmhnVlO0C@ashevche-desk.local>

On Mon, Mar 23, 2026 at 10:51:49AM +0200, Andy Shevchenko wrote:
> On Fri, Mar 20, 2026 at 05:48:44PM -0700, Kees Cook wrote:

...

> > -			char tmp[42];
> >  
> >  			__be32 *dt = (__be32 *)dostype;
> >  			*dt = pb->pb_Environment[16];
> >  			if (dostype[3] < ' ')
> > -				snprintf(tmp, sizeof(tmp), " (%c%c%c^%c)",
> > -					dostype[0], dostype[1],
> > -					dostype[2], dostype[3] + '@' );
> > +				seq_buf_printf(&state->pp_buf,
> > +					       " (%c%c%c^%c)",
> > +					       dostype[0], dostype[1],
> > +					       dostype[2],
> > +					       dostype[3] + '@');
> >  			else
> > -				snprintf(tmp, sizeof(tmp), " (%c%c%c%c)",
> > -					dostype[0], dostype[1],
> > -					dostype[2], dostype[3]);
> > -			strlcat(state->pp_buf, tmp, PAGE_SIZE);
> > -			snprintf(tmp, sizeof(tmp), "(res %d spb %d)",
> > -				be32_to_cpu(pb->pb_Environment[6]),
> > -				be32_to_cpu(pb->pb_Environment[4]));
> > -			strlcat(state->pp_buf, tmp, PAGE_SIZE);
> > +				seq_buf_printf(&state->pp_buf,
> > +					       " (%c%c%c%c)",
> > +					       dostype[0], dostype[1],
> > +					       dostype[2], dostype[3]);
> 
> Wouldn't
> 				seq_buf_printf(&state->pp_buf, " (%.4s)", dostype);
> 
> work?
> 
> But probably okay as in the previous branch it needs more work to follow,
> something like
> 
> 			char dostype[8];
> 			...
> 			if (dostype[3] < ' ') {
> 				/* Escape control character */
> 				dostype[4] = dostype[3] + '@';
> 				dostype[3] = '^';
> 				seq_buf_printf(&state->pp_buf, " (%.5s)", dostype);
> 			} else {
> 				seq_buf_printf(&state->pp_buf, " (%.4s)", dostype);
> 			}

Or maybe even replace the whole conditional with

			seq_buf_printf(&state->pp_buf, " (%4pE)", dostype);

What do you think?

> Taking how invasive is this, it might be better to done separately.
> 
> > +			seq_buf_printf(&state->pp_buf, "(res %d spb %d)",
> > +				       be32_to_cpu(pb->pb_Environment[6]),
> > +				       be32_to_cpu(pb->pb_Environment[4]));

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-03-23 15:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21  0:48 [PATCH] block: partitions: Replace pp_buf with struct seq_buf Kees Cook
2026-03-21 12:08 ` Josh Law
2026-03-21 14:28   ` Jens Axboe
2026-03-21 14:32     ` Josh Law
2026-03-21 14:27 ` Jens Axboe
2026-03-21 15:24 ` David Laight
2026-03-23  8:51 ` Andy Shevchenko
2026-03-23 15:05   ` Andy Shevchenko [this message]
2026-03-23 20:08   ` David Laight
2026-03-23 22:29     ` Kees Cook

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=acFWzUYlNE2k2aca@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=dave@stgolabs.net \
    --cc=hoeppner@linux.ibm.com \
    --cc=kees@kernel.org \
    --cc=ldm@flatcap.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ntfs-dev@lists.sourceforge.net \
    --cc=linux-s390@vger.kernel.org \
    --cc=objecting@objecting.org \
    --cc=sth@linux.ibm.com \
    --cc=thorsten.blum@linux.dev \
    /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