From: Guenter Roeck <linux@roeck-us.net>
To: Hamza Mahfooz <hamza.mahfooz@amd.com>
Cc: linux-kernel@vger.kernel.org,
"Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Lee, Alvin" <Alvin.Lee2@amd.com>,
"Alex Hung" <alex.hung@amd.com>,
"Pavle Kotarac" <Pavle.Kotarac@amd.com>,
"Stylon Wang" <stylon.wang@amd.com>,
"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
"Leo (Hanghong) Ma" <hanghong.ma@amd.com>,
"Hersen Wu" <hersenwu@amd.com>, "Paul Hsieh" <paul.hsieh@amd.com>,
"Jimmy Kizito" <Jimmy.Kizito@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amd/display: fix array-bounds error in dc_stream_remove_writeback()
Date: Wed, 5 Oct 2022 23:46:15 -0700 [thread overview]
Message-ID: <20221006064615.GA2817657@roeck-us.net> (raw)
In-Reply-To: <20220927191200.216488-1-hamza.mahfooz@amd.com>
On Tue, Sep 27, 2022 at 03:12:00PM -0400, Hamza Mahfooz wrote:
> Address the following error:
> 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: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];
> | ~~~~~~~~~~~~~~~~~~~~~~^~~
> 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];
> |
>
> Currently, we aren't checking to see if j remains within
> writeback_info[]'s bounds. So, add a check to make sure that we aren't
> overflowing the buffer.
>
> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
With gcc 11.3, this patch doesn't fix a problem, it introduces one.
Building csky:allmodconfig ... failed
--------------
Error log:
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 1 is above array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
527 | stream->writeback_info[j] = stream->writeback_info[i];
Building mips:allmodconfig ... failed
--------------
Error log:
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];
Building arm:allmodconfig ... failed
--------------
Error log:
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];
Guenter
next prev parent reply other threads:[~2022-10-06 6:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 19:12 Hamza Mahfooz
[not found] ` <CH0PR12MB5284EAC9E9D095B2624631228B559@CH0PR12MB5284.namprd12.prod.outlook.com>
2022-09-29 15:36 ` Felix Kuehling
2022-09-29 15:41 ` Hamza Mahfooz
2022-09-29 16:05 ` Felix Kuehling
2022-10-06 6:46 ` Guenter Roeck [this message]
2022-10-06 17:23 ` Guenter Roeck
2022-10-11 9:49 ` Thorsten Leemhuis
2022-11-08 10:55 wangkailong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221006064615.GA2817657@roeck-us.net \
--to=linux@roeck-us.net \
--cc=Alvin.Lee2@amd.com \
--cc=Jimmy.Kizito@amd.com \
--cc=Pavle.Kotarac@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alex.hung@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamza.mahfooz@amd.com \
--cc=hanghong.ma@amd.com \
--cc=harry.wentland@amd.com \
--cc=hersenwu@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.hsieh@amd.com \
--cc=stylon.wang@amd.com \
--cc=sunpeng.li@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®