Re: [PATCH 09/28] drm/dp_mst: Refactor build_mst_prop_path() to use seq_buf
From: lyude
Date: Thu Sep 17 2026 - 15:04:12 EST
Reviewed-by: Lyude Paul <lyude@xxxxxxxxxx>
Also, out of curiosity - how exactly are you able to get this many
email addresses in To: without your emails getting rejected? Because it
is literally impossible to respond to this email with all of them, and
this has been consistently kind of an issue when trying to submit patch
series that do large refactors like this.
On Tue, 2026-09-15 at 08:18 +0000, Bill Wendling wrote:
> build_mst_prop_path() constructs an MST property path by formatting
> port
> numbers into a temporary buffer and appending them to "proppath" with
> strlcat() in a loop.
>
> In preparation for removing the deprecated strlcat() API[1], use
> struct
> seq_buf and seq_buf_printf() to format the path components directly
> into
> "proppath", eliminating the temporary buffer and repeated string
> scans.
>
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Cc: codemender-patching+linux@xxxxxxxxxx
> Assisted-by: Claude-3-5-Sonnet:20241022 [editor_update_file,
> make_kernel_build_single_file]
> Signed-off-by: Bill Wendling <morbo@xxxxxxxxxx>
> ---
> Cc: Russell King <linux@xxxxxxxxxxxxxxx>
> Cc: Huacai Chen <chenhuacai@xxxxxxxxxx>
> Cc: WANG Xuerui <kernel@xxxxxxxxxx>
> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
> Cc: "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
> Cc: Helge Deller <deller@xxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> Cc: Ian Abbott <abbotti@xxxxxxxxx>
> Cc: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
> Cc: Tony Luck <tony.luck@xxxxxxxxx>
> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: Maxime Ripard <mripard@xxxxxxxxxx>
> Cc: Thomas Zimmermann <tzimmermann@xxxxxxx>
> Cc: David Airlie <airlied@xxxxxxxxx>
> Cc: Simona Vetter <simona@xxxxxxxx>
> Cc: Matthew Brost <matthew.brost@xxxxxxxxx>
> Cc: "Thomas Hellström" <thomas.hellstrom@xxxxxxxxxxxxxxx>
> Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
> Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> Cc: Matthias Schwarzott <zzam@xxxxxxxxxx>
> Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
> Cc: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
> Cc: Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>
> Cc: Andrew Lunn <andrew+netdev@xxxxxxx>
> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
> Cc: Eric Dumazet <edumazet@xxxxxxxxxx>
> Cc: Jakub Kicinski <kuba@xxxxxxxxxx>
> Cc: Paolo Abeni <pabeni@xxxxxxxxxx>
> Cc: Arend van Spriel <arend.vanspriel@xxxxxxxxxxxx>
> Cc: Rob Herring <robh@xxxxxxxxxx>
> Cc: Saravana Kannan <saravanak@xxxxxxxxxx>
> Cc: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
> Cc: Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx>
> Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>
> Cc: Alim Akhtar <alim.akhtar@xxxxxxxxxxx>
> Cc: Linus Walleij <linusw@xxxxxxxxxx>
> Cc: Anil Gurumurthy <anil.gurumurthy@xxxxxxxxxx>
> Cc: Sudarsana Kalluru <sudarsana.kalluru@xxxxxxxxxx>
> Cc: "Martin K. Petersen" <mkp@xxxxxxxxxx>
> Cc: Trond Myklebust <trondmy@xxxxxxxxxx>
> Cc: Anna Schumaker <anna@xxxxxxxxxx>
> Cc: Mike Marshall <hubcap@xxxxxxxxxxxx>
> Cc: Martin Brandenburg <martin@xxxxxxxxxxxx>
> Cc: Kees Cook <kees@xxxxxxxxxx>
> Cc: Jiri Pirko <jiri@xxxxxxxxxxx>
> Cc: Simon Horman <horms@xxxxxxxxxx>
> Cc: Chuck Lever <cel@xxxxxxxxxx>
> Cc: Jeff Layton <jlayton@xxxxxxxxxx>
> Cc: NeilBrown <neil@xxxxxxxxxx>
> Cc: Olga Kornievskaia <okorniev@xxxxxxxxxx>
> Cc: Dai Ngo <Dai.Ngo@xxxxxxxxxx>
> Cc: Tom Talpey <tom@xxxxxxxxxx>
> Cc: Jaroslav Kysela <perex@xxxxxxxx>
> Cc: Takashi Iwai <tiwai@xxxxxxxx>
> Cc: Bill Wendling <morbo@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>
> Cc: Kanglong Wang <wangkanglong@xxxxxxxxxxx>
> Cc: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
> Cc: Qiang Ma <maqianga@xxxxxxxxxxxxx>
> Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> Cc: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
> Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
> Cc: Breno Leitao <leitao@xxxxxxxxxx>
> Cc: Thorsten Blum <blum@xxxxxxxxxx>
> Cc: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Lyude Paul <lyude@xxxxxxxxxx>
> Cc: Ashutosh Desai <ashutoshdesai993@xxxxxxxxx>
> Cc: Imre Deak <imre.deak@xxxxxxxxx>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
> Cc: Johan Hovold <johan@xxxxxxxxxx>
> Cc: Johannes Berg <johannes.berg@xxxxxxxxx>
> Cc: Miri Korenblit <miriam.rachel.korenblit@xxxxxxxxx>
> Cc: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
> Cc: Cryolitia PukNgae <cryolitia@xxxxxxxxxxxxx>
> Cc: Jiaming Zhang <r772577952@xxxxxxxxx>
> Cc: Will Porter <mrwillporter@xxxxxxxxx>
> Cc: Cen Zhang <zzzccc427@xxxxxxxxx>
> Cc: "Cássio Gabriel" <cassiogabrielcontato@xxxxxxxxx>
> Cc: Rong Zhang <i@xxxxxxxx>
> Cc: Arun Raghavan <arunr@xxxxxxxxxxxxxxxxx>
> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: loongarch@xxxxxxxxxxxxxxx
> Cc: linux-mips@xxxxxxxxxxxxxxx
> Cc: linux-parisc@xxxxxxxxxxxxxxx
> Cc: linux-edac@xxxxxxxxxxxxxxx
> Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
> Cc: intel-xe@xxxxxxxxxxxxxxxxxxxxx
> Cc: linux-input@xxxxxxxxxxxxxxx
> Cc: linux-media@xxxxxxxxxxxxxxx
> Cc: intel-wired-lan@xxxxxxxxxxxxxxxx
> Cc: netdev@xxxxxxxxxxxxxxx
> Cc: linux-wireless@xxxxxxxxxxxxxxx
> Cc: brcm80211@xxxxxxxxxxxxxxx
> Cc: brcm80211-dev-list.pdl@xxxxxxxxxxxx
> Cc: devicetree@xxxxxxxxxxxxxxx
> Cc: linux-samsung-soc@xxxxxxxxxxxxxxx
> Cc: linux-gpio@xxxxxxxxxxxxxxx
> Cc: linux-scsi@xxxxxxxxxxxxxxx
> Cc: linux-nfs@xxxxxxxxxxxxxxx
> Cc: devel@xxxxxxxxxxxxxxxxxx
> Cc: linux-hardening@xxxxxxxxxxxxxxx
> Cc: linux-sound@xxxxxxxxxxxxxxx
> ---
> drivers/gpu/drm/display/drm_dp_mst_topology.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> index 7ce9e212770a..229b5fec44bf 100644
> --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> @@ -29,6 +29,7 @@
> #include <linux/kernel.h>
> #include <linux/random.h>
> #include <linux/sched.h>
> +#include <linux/seq_buf.h>
> #include <linux/seq_file.h>
>
> #if IS_ENABLED(CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS)
> @@ -2216,19 +2217,21 @@ static void build_mst_prop_path(const struct
> drm_dp_mst_branch *mstb,
> char *proppath,
> size_t proppath_size)
> {
> + struct seq_buf s;
> int i;
> - char temp[8];
>
> - snprintf(proppath, proppath_size, "mst:%d", mstb->mgr-
> >conn_base_id);
> + seq_buf_init(&s, proppath, proppath_size);
> +
> + seq_buf_printf(&s, "mst:%d", mstb->mgr->conn_base_id);
> for (i = 0; i < (mstb->lct - 1); i++) {
> int shift = (i % 2) ? 0 : 4;
> int port_num = (mstb->rad[i / 2] >> shift) & 0xf;
>
> - snprintf(temp, sizeof(temp), "-%d", port_num);
> - strlcat(proppath, temp, proppath_size);
> + seq_buf_printf(&s, "-%d", port_num);
> }
> - snprintf(temp, sizeof(temp), "-%d", pnum);
> - strlcat(proppath, temp, proppath_size);
> + seq_buf_printf(&s, "-%d", pnum);
> +
> + seq_buf_str(&s);
> }
>
> /**