From: Dan Carpenter <dan.carpenter@oracle.com>
To: Harry Wentland <harry.wentland@amd.com>,
George Shen <george.shen@amd.com>
Cc: kernel-janitors@vger.kernel.org,
"Anson Jacob" <anson.jacob@amd.com>,
"Yongqiang Sun" <yongqiang.sun@amd.com>,
"Jaehyun Chung" <jaehyun.chung@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Wenjing Liu" <wenjing.liu@amd.com>,
"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
"Bhawanpreet Lakha" <Bhawanpreet.Lakha@amd.com>,
"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
"Melissa Wen" <melissa.srw@gmail.com>,
"David Airlie" <airlied@linux.ie>,
"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
amd-gfx@lists.freedesktop.org, "Daniel Vetter" <daniel@ffwll.ch>,
"Wyatt Wood" <wyatt.wood@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Anthony Koo" <Anthony.Koo@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: [PATCH] drm/amd/display: Fix a potential NULL dereference
Date: Mon, 25 Jan 2021 11:45:08 +0300 [thread overview]
Message-ID: <YA6FFK+F1XbGbYVJ@mwanda> (raw)
The debug printk dereferences "link->link_enc" before we have ensured
that it is non-NULL. Fix this potential NULL derefence by moving the
printk after the check.
Fixes: 1975b95ad4e7 ("drm/amd/display: Log link/connector info provided in BIOS object table")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/display/dc/core/dc_link.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index c16af3983fdb..4d31b2fae1f9 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1525,13 +1525,13 @@ static bool dc_link_construct(struct dc_link *link,
link->link_enc =
link->dc->res_pool->funcs->link_enc_create(&enc_init_data);
- DC_LOG_DC("BIOS object table - DP_IS_USB_C: %d", link->link_enc->features.flags.bits.DP_IS_USB_C);
-
if (!link->link_enc) {
DC_ERROR("Failed to create link encoder!\n");
goto link_enc_create_fail;
}
+ DC_LOG_DC("BIOS object table - DP_IS_USB_C: %d", link->link_enc->features.flags.bits.DP_IS_USB_C);
+
link->link_enc_hw_inst = link->link_enc->transmitter;
for (i = 0; i < 4; i++) {
--
2.29.2
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Harry Wentland <harry.wentland@amd.com>,
George Shen <george.shen@amd.com>
Cc: kernel-janitors@vger.kernel.org,
"Anson Jacob" <anson.jacob@amd.com>,
"Yongqiang Sun" <yongqiang.sun@amd.com>,
"Jaehyun Chung" <jaehyun.chung@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Wenjing Liu" <wenjing.liu@amd.com>,
"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
"Bhawanpreet Lakha" <Bhawanpreet.Lakha@amd.com>,
"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
"Melissa Wen" <melissa.srw@gmail.com>,
"David Airlie" <airlied@linux.ie>,
"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
amd-gfx@lists.freedesktop.org, "Daniel Vetter" <daniel@ffwll.ch>,
"Wyatt Wood" <wyatt.wood@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Anthony Koo" <Anthony.Koo@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: [PATCH] drm/amd/display: Fix a potential NULL dereference
Date: Mon, 25 Jan 2021 08:45:08 +0000 [thread overview]
Message-ID: <YA6FFK+F1XbGbYVJ@mwanda> (raw)
The debug printk dereferences "link->link_enc" before we have ensured
that it is non-NULL. Fix this potential NULL derefence by moving the
printk after the check.
Fixes: 1975b95ad4e7 ("drm/amd/display: Log link/connector info provided in BIOS object table")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/display/dc/core/dc_link.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index c16af3983fdb..4d31b2fae1f9 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1525,13 +1525,13 @@ static bool dc_link_construct(struct dc_link *link,
link->link_enc link->dc->res_pool->funcs->link_enc_create(&enc_init_data);
- DC_LOG_DC("BIOS object table - DP_IS_USB_C: %d", link->link_enc->features.flags.bits.DP_IS_USB_C);
-
if (!link->link_enc) {
DC_ERROR("Failed to create link encoder!\n");
goto link_enc_create_fail;
}
+ DC_LOG_DC("BIOS object table - DP_IS_USB_C: %d", link->link_enc->features.flags.bits.DP_IS_USB_C);
+
link->link_enc_hw_inst = link->link_enc->transmitter;
for (i = 0; i < 4; i++) {
--
2.29.2
next reply other threads:[~2021-01-25 8:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-25 8:45 Dan Carpenter [this message]
2021-01-25 8:45 ` [PATCH] drm/amd/display: Fix a potential NULL dereference Dan Carpenter
2021-01-25 15:45 ` Alex Deucher
2021-01-25 15:45 ` Alex Deucher
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=YA6FFK+F1XbGbYVJ@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Anthony.Koo@amd.com \
--cc=Bhawanpreet.Lakha@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=anson.jacob@amd.com \
--cc=aurabindo.pillai@amd.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=george.shen@amd.com \
--cc=harry.wentland@amd.com \
--cc=jaehyun.chung@amd.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=melissa.srw@gmail.com \
--cc=nicholas.kazlauskas@amd.com \
--cc=sunpeng.li@amd.com \
--cc=wenjing.liu@amd.com \
--cc=wyatt.wood@amd.com \
--cc=yongqiang.sun@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.