On Tue, Sep 15, 2026 at 08:18:45AM +0000, Bill Wendling wrote:
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c 
> b/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c

This is the same file touched as
https://lore.kernel.org/all/[email protected]/
and doing the same thing, roughly? I think it'd be best to combine
these, especially since one depends on the other's addition of seq_buf.h

> index 5db7fc067c4d..548a50f74422 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> @@ -377,8 +377,10 @@ static ssize_t sched_group_engines_read(struct file 
> *file, char __user *buf,
>       struct xe_hw_engine *hwe;
>       enum xe_hw_engine_id id;
>       char engines[128];
> +     struct seq_buf s;
> +     const char *s_str;
>  
> -     engines[0] = '\0';
> +     seq_buf_init(&s, engines, sizeof(engines));

As with the others, DECLARE_SEQ_BUF should be used.

>       if (group < num_groups) {
>               for_each_hw_engine(hwe, gt, id) {
> @@ -386,15 +388,14 @@ static ssize_t sched_group_engines_read(struct file 
> *file, char __user *buf,
>                       u16 guc_logical_instance = 
> xe_hwe_guc_logical_instance(hwe);
>                       u32 mask = groups[group].engines[guc_class];
>  
> -                     if (mask & BIT(guc_logical_instance)) {
> -                             strlcat(engines, hwe->name, sizeof(engines));
> -                             strlcat(engines, " ", sizeof(engines));
> -                     }
> +                     if (mask & BIT(guc_logical_instance))
> +                             seq_buf_printf(&s, "%s ", hwe->name);
>               }
> -             strlcat(engines, "\n", sizeof(engines));
> +             seq_buf_puts(&s, "\n");
>       }
>  
> -     return simple_read_from_buffer(buf, count, ppos, engines, 
> strlen(engines));
> +     s_str = seq_buf_str(&s);
> +     return simple_read_from_buffer(buf, count, ppos, s_str, strlen(s_str));

While this is the correct length, it does illustrate why I think we need
a new seq_buf helper to get the strlen result detected from NUL
termination like seq_buf_str().

-Kees

-- 
Kees Cook

Reply via email to