]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
block: partitions: Replace pp_buf with struct seq_buf
authorKees Cook <kees@kernel.org>
Sat, 21 Mar 2026 00:48:44 +0000 (17:48 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 21 Mar 2026 14:27:08 +0000 (08:27 -0600)
commitc2d466b9fe1913f8dbe2701156c38719c94188f7
tree3b003e57eed218c9bd08973a80c39a6bf86cd305
parent7b6d3255e7f8c6df2d21504c47808e3ce84649ac
block: partitions: Replace pp_buf with struct seq_buf

In preparation for removing the strlcat API[1], replace the char *pp_buf
with a struct seq_buf, which tracks the current write position and
remaining space internally. This allows for:

- Direct use of seq_buf_printf() in place of snprintf()+strlcat()
  pairs, eliminating local tmp buffers throughout.
- Adjacent strlcat() calls that build strings piece-by-piece
  (e.g., strlcat("["); strlcat(name); strlcat("]")) to be collapsed
  into single seq_buf_printf() calls.
- Simpler call sites: seq_buf_puts() takes only the buffer and string,
  with no need to pass PAGE_SIZE at every call.

The backing buffer allocation is unchanged (__get_free_page), and the
output path uses seq_buf_str() to NUL-terminate before passing to
printk().

Link: https://github.com/KSPP/linux/issues/370
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Josh Law <objecting@objecting.org>
Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: Josh Law <objecting@objecting.org>
Link: https://patch.msgid.link/20260321004840.work.670-kees@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 files changed:
block/partitions/acorn.c
block/partitions/aix.c
block/partitions/amiga.c
block/partitions/atari.c
block/partitions/check.h
block/partitions/cmdline.c
block/partitions/core.c
block/partitions/efi.c
block/partitions/ibm.c
block/partitions/karma.c
block/partitions/ldm.c
block/partitions/mac.c
block/partitions/msdos.c
block/partitions/of.c
block/partitions/osf.c
block/partitions/sgi.c
block/partitions/sun.c
block/partitions/sysv68.c
block/partitions/ultrix.c