linux-next: build failure after merge of the drm tree
[email protected]
maintainerHi all,
After merging the drm tree, today's linux-next build (x86_64 allmodconfig) failed like this:
/tmp/next/build/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c: In function 'dc_stream_remove_writeback':/tmp/next/build/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:527:55: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
527 | stream->writeback_info[j] = stream->writeback_info[i];
| ~~~~~~~~~~~~~~~~~~~~~~^~~cc1: all warnings being treated as errors
Caused by
5d8c3e836fc224 ("drm/amd/display: fix array-bounds error in dc_stream_remove_writeback()")
I have reverted that commit for today.
Quoted 8 lines · On Fri, 30 Sep 2022 11:54:34 +0100 [email protected] wrote:
After merging the drm tree, today's linux-next build (
x86_64allmodconfig) failed like this:
/tmp/next/build/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c: In function 'dc_stream_remove_writeback':/tmp/next/build/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:527:55: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]527 | stream->writeback_info[j] = stream->writeback_info[i]; | ~~~~~~~~~~~~~~~~~~~~~~^~~
Quoted 7 lines
cc1: all warnings being treated as errors
Caused by
5d8c3e836fc224("drm/amd/display: fix array-bounds error indc_stream_remove_writeback()")I have reverted that commit for today.
I am still getting this failure. The full error is:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c: In function 'dc_stream_remove_writeback':drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:527:83: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
527 | stream->writeback_info[j] = stream->writeback_info[i];
| ~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc.h:1269,
from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:29,
from drivers/gpu/drm/amd/amdgpu/../display/dc/basics/dc_common.h:29,
from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:27:
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_stream.h:241:34: note: while referencing 'writeback_info'
241 | struct dc_writeback_info writeback_info[MAX_DWB_PIPES];
| ^~~~~~~~~~~~~~I have reverted that commit again today.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 24 lines · Stephen Rothwell
Quoted 8 lines · On Fri, 30 Sep 2022 11:54:34 +0100 [email protected] wrote:
After merging the drm tree, today's linux-next build (
x86_64allmodconfig) failed like this:
/tmp/next/build/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c: In function 'dc_stream_remove_writeback':/tmp/next/build/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:527:55: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]527 | stream->writeback_info[j] = stream->writeback_info[i]; | ~~~~~~~~~~~~~~~~~~~~~~^~~Quoted 7 lines
cc1: all warnings being treated as errors
Caused by
5d8c3e836fc224("drm/amd/display: fix array-bounds error indc_stream_remove_writeback()")I have reverted that commit for today.
I am still getting this failure. The full error is:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c: In function 'dc_stream_remove_writeback':drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:527:83: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
Quoted 9 lines
527 | stream->writeback_info[j] = stream->writeback_info[i];
| ~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc.h:1269,
from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:29,
from drivers/gpu/drm/amd/amdgpu/../display/dc/basics/dc_common.h:29,
from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:27:
drivers/gpu/drm/amd/amdgpu/../display/dc/dc_stream.h:241:34: note: while referencing 'writeback_info'
241 | struct dc_writeback_info writeback_info[MAX_DWB_PIPES];
| ^~~~~~~~~~~~~~I'm not seeing it here, what gcc is this with?
Dave.
Hi Dave,
Quoted 34 lines · On Tue, 4 Oct 2022 12:24:37 +1000 David Airlie <[email protected]> wrote:
Quoted 22 lines · Stephen Rothwell
Quoted 8 lines · On Fri, 30 Sep 2022 11:54:34 +0100 [email protected] wrote:
After merging the drm tree, today's linux-next build (
x86_64allmodconfig) failed like this:
/tmp/next/build/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c: In function 'dc_stream_remove_writeback':/tmp/next/build/drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:527:55: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]527 | stream->writeback_info[j] = stream->writeback_info[i]; | ~~~~~~~~~~~~~~~~~~~~~~^~~Quoted 7 lines
cc1: all warnings being treated as errors
Caused by
5d8c3e836fc224("drm/amd/display: fix array-bounds error indc_stream_remove_writeback()")I have reverted that commit for today.
I am still getting this failure. The full error is:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c: In function 'dc_stream_remove_writeback':drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:527:83: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]Quoted 9 lines
527 | stream->writeback_info[j] = stream->writeback_info[i]; | ~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc.h:1269, from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:29, from drivers/gpu/drm/amd/amdgpu/../display/dc/basics/dc_common.h:29, from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:27: drivers/gpu/drm/amd/amdgpu/../display/dc/dc_stream.h:241:34: note: while referencing 'writeback_info' 241 | struct dc_writeback_info writeback_info[MAX_DWB_PIPES]; | ^~~~~~~~~~~~~~
Quoted 1 line
I'm not seeing it here, what gcc is this with?
I am using an x86_64 cross compiler hosted on ppc64le - gcc v11.2.0 (on Debian).
Signature · 2 lines
Cheers, Stephen Rothwell
Mark Brown
maintainerQuoted 7 lines · Stephen Rothwell
Quoted 3 lines · On Tue, 4 Oct 2022 12:24:37 +1000 David Airlie <[email protected]> wrote:
On Tue, Oct 4, 2022 at 12:21 PM Stephen Rothwell <[email protected]> wrote:
I'm not seeing it here, what gcc is this with?
I am using an
x86_64cross compiler hosted on ppc64le - gcc v11.2.0 (on Debian).
I was seeing this with an x86_64 cross compiler hosted on arm64 - Ubuntu 11.2.0-17ubuntu1 from the looks of it.
@Mahfooz, Hamza
@Aurabindo Pillai can you get this fixed up?
Thanks,
Alex
Quoted 12 lines · Mark Brown
Quoted 7 lines · Stephen Rothwell
Quoted 3 lines · On Tue, 4 Oct 2022 12:24:37 +1000 David Airlie <[email protected]> wrote:
On Tue, Oct 4, 2022 at 12:21 PM Stephen Rothwell <[email protected]> wrote:
I'm not seeing it here, what gcc is this with?
I am using an
x86_64cross compiler hosted on ppc64le - gcc v11.2.0 (on Debian).I was seeing this with an
x86_64cross compiler hosted on arm64 - Ubuntu 11.2.0-17ubuntu1 from the looks of it.
Quoted 3 lines · Alex Deucher
@Mahfooz, Hamza
@Aurabindo Pillai can you get this fixed up?
Seems like this is a false positive for GCC versions pre-12, because I'm not seeing this warning on GCC 12.2. However, we can fix this for older GCC versions with the following:
drivers/gpu/drm/amd/display/dc/dc_stream.h +1 -1
@@ -238,7 +238,7 @@ struct dc_stream_state {/* writeback */ unsigned int num_wb_info; -struct dc_writeback_info writeback_info[MAX_DWB_PIPES ]; +struct dc_writeback_info writeback_info[MAX_DWB_PIPES +1 ];const struct dc_transfer_func *func_shaper;const struct dc_3dlut *lut3d_func;/* Computed state bits */
Quoted 17 lines
Thanks,
Alex
Quoted 12 lines · Mark Brown
Quoted 7 lines · Stephen Rothwell
Quoted 3 lines · On Tue, 4 Oct 2022 12:24:37 +1000 David Airlie <[email protected]> wrote:
On Tue, Oct 4, 2022 at 12:21 PM Stephen Rothwell <[email protected]> wrote:
I'm not seeing it here, what gcc is this with?
I am using an
x86_64cross compiler hosted on ppc64le - gcc v11.2.0 (on Debian).I was seeing this with an
x86_64cross compiler hosted on arm64 - Ubuntu 11.2.0-17ubuntu1 from the looks of it.
Signature · 1 line
Hamza
Hi all,
Quoted 14 lines · On Wed, 5 Oct 2022 12:45:31 -0400 Hamza Mahfooz <[email protected]> wrote:
Quoted 3 lines · Alex Deucher
@Mahfooz, Hamza
@Aurabindo Pillai can you get this fixed up?Seems like this is a false positive for GCC versions pre-12, because I'm not seeing this warning on GCC 12.2. However, we can fix this for older GCC versions with the following:
drivers/gpu/drm/amd/display/dc/dc_stream.h +0
-0
drivers/gpu/drm/amd/display/dc/dc_stream.h struct dc_stream_state { · line 244
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dc_stream.h +1
-1@@ -238,7 +238,7 @@ struct dc_stream_state {/* writeback */ unsigned int num_wb_info; -struct dc_writeback_info writeback_info[MAX_DWB_PIPES ]; +struct dc_writeback_info writeback_info[MAX_DWB_PIPES +1 ];const struct dc_transfer_func *func_shaper;const struct dc_3dlut *lut3d_func;/* Computed state bits */
This is now in Linus' tree :-(
I have applied the following hack for today:
From: Stephen Rothwell <[email protected]>
Date: Thu, 6 Oct 2022 09:14:26 +1100
Subject: [PATCH] fix up for drivers/gpu/drm/amd/display/dc/core/dc_stream.c
--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2 -2
@@ -520,9 +520,9 @@ bool dc_stream_remove_writeback(struct dc *dc, }/* remove writeback info for disabled writeback pipes from stream */ -for (i =0 , j =0 ; i < stream->num_wb_info && j <MAX_DWB_PIPES ; i++) { +for (i =0 , j =0 ; i < stream->num_wb_info && i <MAX_DWB_PIPES ; i++) {if (stream->writeback_info[i].wb_enabled) { -if (i != j) +if ((j >=0 ) && (j < i))/* trim the array */ stream->writeback_info[j] = stream->writeback_info[i]; j++;
Signature · 5 lines
2.35.1 -- Cheers, Stephen Rothwell
Hi all,
Quoted 18 lines · On Thu, 6 Oct 2022 09:28:10 +1100 Stephen Rothwell <[email protected]> wrote:
I have applied the following hack for today:
From: Stephen Rothwell <[email protected]>
Date: Thu, 6 Oct 2022 09:14:26 +1100
Subject: [PATCH] fix up fordrivers/gpu/drm/amd/display/dc/core/dc_stream.cSigned-off-by Stephen Rothwell <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/core/dc_stream.c +0
-0@@ -520,9 +520,9 @@ bool dc_stream_remove_writeback(struct dc *dc, }
drivers/gpu/drm/amd/display/dc/core/dc_stream.c bool dc_stream_remove_writeback(struct dc *dc, · line 528
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2
-2/* remove writeback info for disabled writeback pipes from stream */ -for (i =0 , j =0 ; i < stream->num_wb_info && j <MAX_DWB_PIPES ; i++) { +for (i =0 , j =0 ; i < stream->num_wb_info && i <MAX_DWB_PIPES ; i++) {if (stream->writeback_info[i].wb_enabled) { -if (i != j) +if ((j >=0 ) && (j < i))/* trim the array */ stream->writeback_info[j] = stream->writeback_info[i]; j++;
This works as well, and (in my opinion) is better:
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +3 -3
@@ -499,7 +499,7 @@ bool dc_stream_remove_writeback(struct dc *dc, struct dc_stream_state *stream, uint32_t dwb_pipe_inst) { - int i = 0, j = 0; +unsigned int i, j;if (stream ==NULL ) {dm_error ("DC: dc_stream is NULL!\n" );return false;
@@ -520,9 +520,9 @@ bool dc_stream_remove_writeback(struct dc *dc, }/* remove writeback info for disabled writeback pipes from stream */ -for (i =0 , j =0 ; i < stream->num_wb_info && j <MAX_DWB_PIPES ; i++) { +for (i =0 , j =0 ; i < stream->num_wb_info; i++) {if (stream->writeback_info[i].wb_enabled) { -if (i != j) +if (j < i)/* trim the array */ stream->writeback_info[j] = stream->writeback_info[i]; j++;
Signature · 2 lines
Cheers, Stephen Rothwell
This looks good to me. Care to add you s-o-b?
Alex
Quoted 64 lines · Stephen Rothwell
Hi all,
Quoted 18 lines · On Thu, 6 Oct 2022 09:28:10 +1100 Stephen Rothwell <[email protected]> wrote:
I have applied the following hack for today:
From: Stephen Rothwell <[email protected]>
Date: Thu, 6 Oct 2022 09:14:26 +1100
Subject: [PATCH] fix up fordrivers/gpu/drm/amd/display/dc/core/dc_stream.cSigned-off-by Stephen Rothwell <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/core/dc_stream.c +0
-0@@ -520,9 +520,9 @@ bool dc_stream_remove_writeback(struct dc *dc, }drivers/gpu/drm/amd/display/dc/core/dc_stream.c bool dc_stream_remove_writeback(struct dc *dc, · line 528
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2
-2/* remove writeback info for disabled writeback pipes from stream */ -for (i =0 , j =0 ; i < stream->num_wb_info && j <MAX_DWB_PIPES ; i++) { +for (i =0 , j =0 ; i < stream->num_wb_info && i <MAX_DWB_PIPES ; i++) {if (stream->writeback_info[i].wb_enabled) { -if (i != j) +if ((j >=0 ) && (j < i))/* trim the array */ stream->writeback_info[j] = stream->writeback_info[i]; j++;This works as well, and (in my opinion) is better:
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +3
-4@@ -499,7 +499,7 @@ bool dc_stream_remove_writeback(struct dc *dc, struct dc_stream_state *stream, uint32_t dwb_pipe_inst) { - int i = 0, j = 0; +unsigned int i, j;if (stream ==NULL ) {dm_error ("DC: dc_stream is NULL!\n" );return false;@@ -520,9 +520,9 @@ bool dc_stream_remove_writeback(struct dc *dc, }/* remove writeback info for disabled writeback pipes from stream */ -for (i =0 , j =0 ; i < stream->num_wb_info && j <MAX_DWB_PIPES ; i++) { +for (i =0 , j =0 ; i < stream->num_wb_info; i++) {if (stream->writeback_info[i].wb_enabled) { -if (i != j) +if (j < i)/* trim the array */ stream->writeback_info[j] = stream->writeback_info[i]; j++; --Cheers,
Stephen Rothwell
Hi Alex,
Quoted 23 lines · On Thu, 6 Oct 2022 09:56:32 -0400 Alex Deucher <[email protected]> wrote:
This looks good to me. Care to add you s-o-b?
Quoted 19 lines · Stephen Rothwell
This works as well, and (in my opinion) is better:
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +1
-1@@ -499,7 +499,7 @@ bool dc_stream_remove_writeback(struct dc *dc, struct dc_stream_state *stream, uint32_t dwb_pipe_inst) { - int i = 0, j = 0; +unsigned int i, j;if (stream ==NULL ) {dm_error ("DC: dc_stream is NULL!\n" );return false;@@ -520,9 +520,9 @@ bool dc_stream_remove_writeback(struct dc *dc, }
Quoted 9 lines
drivers/gpu/drm/amd/display/dc/core/dc_stream.c bool dc_stream_remove_writeback(struct dc *dc, · line 528
Quoted 9 lines
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2
-2/* remove writeback info for disabled writeback pipes from stream */ -for (i =0 , j =0 ; i < stream->num_wb_info && j <MAX_DWB_PIPES ; i++) { +for (i =0 , j =0 ; i < stream->num_wb_info; i++) {if (stream->writeback_info[i].wb_enabled) { -if (i != j) +if (j < i)/* trim the array */ stream->writeback_info[j] = stream->writeback_info[i]; j++;
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 22 lines · Stephen Rothwell
Hi all,
Quoted 19 lines · On Thu, 6 Oct 2022 09:28:10 +1100 Stephen Rothwell <[email protected]> wrote:
I have applied the following hack for today:
From: Stephen Rothwell <[email protected]>
Date: Thu, 6 Oct 2022 09:14:26 +1100
Subject: [PATCH] fix up fordrivers/gpu/drm/amd/display/dc/core/dc_stream.cSigned-off-by Stephen Rothwell <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/core/dc_stream.c +0
-0@@ -520,9 +520,9 @@ bool dc_stream_remove_writeback(struct dc *dc, }
Quoted 11 lines
drivers/gpu/drm/amd/display/dc/core/dc_stream.c bool dc_stream_remove_writeback(struct dc *dc, · line 528
Quoted 9 lines
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2
-2/* remove writeback info for disabled writeback pipes from stream */ -for (i =0 , j =0 ; i < stream->num_wb_info && j <MAX_DWB_PIPES ; i++) { +for (i =0 , j =0 ; i < stream->num_wb_info && i <MAX_DWB_PIPES ; i++) {if (stream->writeback_info[i].wb_enabled) { -if (i != j) +if ((j >=0 ) && (j < i))/* trim the array */ stream->writeback_info[j] = stream->writeback_info[i]; j++;This works as well, and (in my opinion) is better:
I can confirm that this fix works on GCC 9.4, as well.
Quoted 27 lines
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +3
-3@@ -499,7 +499,7 @@ bool dc_stream_remove_writeback(struct dc *dc, struct dc_stream_state *stream, uint32_t dwb_pipe_inst) { - int i = 0, j = 0; +unsigned int i, j;if (stream ==NULL ) {dm_error ("DC: dc_stream is NULL!\n" );return false;@@ -520,9 +520,9 @@ bool dc_stream_remove_writeback(struct dc *dc, }/* remove writeback info for disabled writeback pipes from stream */ -for (i =0 , j =0 ; i < stream->num_wb_info && j <MAX_DWB_PIPES ; i++) { +for (i =0 , j =0 ; i < stream->num_wb_info; i++) {if (stream->writeback_info[i].wb_enabled) { -if (i != j) +if (j < i)/* trim the array */ stream->writeback_info[j] = stream->writeback_info[i]; j++;
Signature · 1 line
Hamza