On Thu, May 28, 2026 at 9:56 PM Qiang Yu <[email protected]> wrote:
>
> From: Qiang Yu <[email protected]>
>
> This fixes read /sys/class/drm/cardN/device/devcoredump/data
> return empty content sometimes.
>
> amdgpu_devcoredump_format() leaves struct drm_print_iterator's
> .start field uninitialized on the stack before passing it to
> drm_coredump_printer(). __drm_puts_coredump() compares the running
> .offset against .start to decide whether to skip or copy each
> chunk:
>
>         if (iterator->offset < iterator->start) {
>                 if (iterator->offset + len <= iterator->start) {
>                         iterator->offset += len;
>                         return;
>                 }
>                 ...
>         }
>
> Fixes: 4f28b4930f8e ("drm/amdgpu: move devcoredump generation to a worker")
> Signed-off-by: Qiang Yu <[email protected]>

Acked-by: Alex Deucher <[email protected]>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
> index 46043a1479e4..63d7ef78c025 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
> @@ -219,6 +219,7 @@ amdgpu_devcoredump_format(char *buffer, size_t count, 
> struct amdgpu_coredump_inf
>         u32 ring_idx, off;
>
>         iter.data = buffer;
> +       iter.start = 0;
>         iter.offset = 0;
>         iter.remain = count;
>
> --
> 2.43.0
>

Reply via email to