From: wangkailong@jari.cn
To: Wentland <harry.wentland@amd.com>, Li <sunpeng.li@amd.com>,
Siqueira <Rodrigo.Siqueira@amd.com>,
Deucher <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>, Airlie <airlied@gmail.com>,
Vetter <daniel@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] drm/amd/display: fix array-bounds error in dc_stream_remove_writeback()
Date: Tue, 8 Nov 2022 18:55:03 +0800 (GMT+08:00) [thread overview]
Message-ID: <7bafafdf.f5.18456e11abd.Coremail.wangkailong@jari.cn> (raw)
replace the subsequent check for 'i != j' with
Delete header file "timing_generator.h"
Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 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 38d71b5c1f2d..66661a20117b 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -29,7 +29,6 @@
#include "core_types.h"
#include "resource.h"
#include "ipp.h"
-#include "timing_generator.h"
#include "dc_dmub_srv.h"
#define DC_LOGGER dc->ctx->logger
@@ -152,9 +151,8 @@ static void dc_stream_free(struct kref *kref)
void dc_stream_release(struct dc_stream_state *stream)
{
- if (stream != NULL) {
+ if (stream != NULL)
kref_put(&stream->refcount, dc_stream_free);
- }
}
struct dc_stream_state *dc_create_stream_for_sink(
@@ -316,11 +314,11 @@ bool dc_stream_set_cursor_attributes(
struct dc *dc;
bool reset_idle_optimizations = false;
- if (NULL == stream) {
+ if (stream == NULL) {
dm_error("DC: dc_stream is NULL!\n");
return false;
}
- if (NULL == attributes) {
+ if (attributes == NULL) {
dm_error("DC: attributes is NULL!\n");
return false;
}
@@ -399,12 +397,12 @@ bool dc_stream_set_cursor_position(
struct dc *dc = stream->ctx->dc;
bool reset_idle_optimizations = false;
- if (NULL == stream) {
+ if (stream == NULL) {
dm_error("DC: dc_stream is NULL!\n");
return false;
}
- if (NULL == position) {
+ if (position == NULL) {
dm_error("DC: cursor position is NULL!\n");
return false;
}
@@ -468,9 +466,8 @@ bool dc_stream_add_writeback(struct dc *dc,
}
}
- if (!isDrc) {
+ if (!isDrc)
stream->writeback_info[stream->num_wb_info++] = *wb_info;
- }
if (dc->hwss.enable_writeback) {
struct dc_stream_status *stream_status = dc_stream_get_status(stream);
@@ -526,7 +523,7 @@ 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; i++) {
if (stream->writeback_info[i].wb_enabled) {
- if (j < i)
+ if (i != j)
/* trim the array */
stream->writeback_info[j] = stream->writeback_info[i];
j++;
--
2.36.1
next reply other threads:[~2022-11-08 11:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 10:55 wangkailong [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-09-27 19:12 [PATCH] drm/amd/display: fix array-bounds error in dc_stream_remove_writeback() 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
2022-10-06 17:23 ` Guenter Roeck
2022-10-11 9:49 ` Thorsten Leemhuis
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=7bafafdf.f5.18456e11abd.Coremail.wangkailong@jari.cn \
--to=wangkailong@jari.cn \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).