2022-09-30 11:18:20

by Mark Brown

[permalink] [raw]
Subject: linux-next: build failure after merge of the drm tree

Hi 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.


2022-10-04 02:46:00

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

Hi [email protected],

On Fri, 30 Sep 2022 11:54:34 +0100 [email protected] wrote:
>
> 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.

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.
--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2022-10-04 03:02:36

by David Airlie

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

On Tue, Oct 4, 2022 at 12:21 PM Stephen Rothwell <[email protected]> wrote:
>
> Hi [email protected],
>
> On Fri, 30 Sep 2022 11:54:34 +0100 [email protected] wrote:
> >
> > 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.
>
> 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'm not seeing it here, what gcc is this with?

Dave.

2022-10-04 03:11:12

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

Hi Dave,

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:
> >
> > On Fri, 30 Sep 2022 11:54:34 +0100 [email protected] wrote:
> > >
> > > 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.
> >
> > 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'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).

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2022-10-04 12:36:40

by Mark Brown

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

On Tue, Oct 04, 2022 at 02:05:58PM +1100, Stephen Rothwell wrote:
> 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_64 cross 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.


Attachments:
(No filename) (488.00 B)
signature.asc (499.00 B)
Download all attachments

2022-10-05 16:17:19

by Alex Deucher

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

@Mahfooz, Hamza
@Aurabindo Pillai can you get this fixed up?

Thanks,

Alex

On Tue, Oct 4, 2022 at 7:39 AM Mark Brown <[email protected]> wrote:
>
> On Tue, Oct 04, 2022 at 02:05:58PM +1100, Stephen Rothwell wrote:
> > 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_64 cross 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.

2022-10-05 17:45:29

by Hamza Mahfooz

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

On 2022-10-05 11:30, Alex Deucher wrote:
> @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:

diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h
b/drivers/gpu/drm/amd/display/dc/dc_stream.h
index 9e6025c98db9..67fede4bf248 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_stream.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h
@@ -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 */


> Thanks,
>
> Alex
>
> On Tue, Oct 4, 2022 at 7:39 AM Mark Brown <[email protected]> wrote:
>>
>> On Tue, Oct 04, 2022 at 02:05:58PM +1100, Stephen Rothwell wrote:
>>> 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_64 cross 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.

--
Hamza

2022-10-05 22:47:25

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

Hi all,

On Wed, 5 Oct 2022 12:45:31 -0400 Hamza Mahfooz <[email protected]> wrote:
>
> On 2022-10-05 11:30, Alex Deucher wrote:
> > @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:
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/amd/display/dc/dc_stream.h
> index 9e6025c98db9..67fede4bf248 100644
> --- a/drivers/gpu/drm/amd/display/dc/dc_stream.h
> +++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h
> @@ -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

Signed-off-by: Stephen Rothwell <[email protected]>
---
drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index ae13887756bf..a5da787b7876 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -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++;
--
2.35.1

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2022-10-06 08:16:21

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

Hi all,

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 for drivers/gpu/drm/amd/display/dc/core/dc_stream.c
>
> Signed-off-by: Stephen Rothwell <[email protected]>
> ---
> drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> index ae13887756bf..a5da787b7876 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> @@ -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++;

This works as well, and (in my opinion) is better:

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index ae13887756bf..fb6222d4c430 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -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


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2022-10-06 14:17:42

by Alex Deucher

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

This looks good to me. Care to add you s-o-b?

Alex

On Thu, Oct 6, 2022 at 4:12 AM Stephen Rothwell <[email protected]> wrote:
>
> Hi all,
>
> 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 for drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> >
> > Signed-off-by: Stephen Rothwell <[email protected]>
> > ---
> > drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> > index ae13887756bf..a5da787b7876 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> > @@ -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++;
>
> This works as well, and (in my opinion) is better:
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> index ae13887756bf..fb6222d4c430 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> @@ -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

2022-10-06 16:56:47

by Hamza Mahfooz

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

On 2022-10-06 04:12, Stephen Rothwell wrote:
> Hi all,
>
> 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 for drivers/gpu/drm/amd/display/dc/core/dc_stream.c
>>
>> Signed-off-by: Stephen Rothwell <[email protected]>
>> ---
>> drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
>> index ae13887756bf..a5da787b7876 100644
>> --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
>> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
>> @@ -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++;
>
> This works as well, and (in my opinion) is better:

I can confirm that this fix works on GCC 9.4, as well.

>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> index ae13887756bf..fb6222d4c430 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> @@ -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++;
>

--
Hamza

2022-10-06 21:41:16

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the drm tree

Hi Alex,

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?
>
> On Thu, Oct 6, 2022 at 4:12 AM Stephen Rothwell <[email protected]> wrote:
> >
> > This works as well, and (in my opinion) is better:
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> > index ae13887756bf..fb6222d4c430 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> > @@ -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++;

Signed-off-by: Stephen Rothwell <[email protected]>

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature