gcc 12.1.1 warnings around display writeback

Dave Airlie airlied at gmail.com
Wed Jun 1 01:34:53 UTC 2022


I recently finally got my build box updated to a modern gcc, and I
started seeing

/home/airlied/devel/kernel/dim/src/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:
In function ‘dc_stream_remove_writeback’:
/home/airlied/devel/kernel/dim/src/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:523:55:
warning: array subscript [0, 0] is outside array bounds of ‘struct
dc_writeback_info[1]’ [-Warray-bounds]
  523 |                                 stream->writeback_info[j] =
stream->writeback_info[i];
      |                                 ~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from
/home/airlied/devel/kernel/dim/src/drivers/gpu/drm/amd/amdgpu/../display/dc/dc.h:1110,
                 from
/home/airlied/devel/kernel/dim/src/drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:29,
                 from
/home/airlied/devel/kernel/dim/src/drivers/gpu/drm/amd/amdgpu/../display/dc/basics/dc_common.h:29,
                 from
/home/airlied/devel/kernel/dim/src/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:30:
/home/airlied/devel/kernel/dim/src/drivers/gpu/drm/amd/amdgpu/../display/dc/dc_stream.h:230:34:
note: while referencing ‘writeback_info’
  230 |         struct dc_writeback_info writeback_info[MAX_DWB_PIPES];
      |                                  ^~~~~~~~~~~~~~

There's a bunch of code in dc_stream.c to handle multiple writeback
info, but MAX_DWB_PIPES is set to 1, will this ever be increased? can
we rip out the code that assumes it's > 1?

Dave.


More information about the amd-gfx mailing list