From: "Ernst Sjöstrand" <ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH v2 2/3] amdgpu/dc: Fix potential null dereferences in amdgpu_dm.c
Date: Tue, 7 Nov 2017 21:06:58 +0100 [thread overview]
Message-ID: <20171107200659.21094-2-ernstp@gmail.com> (raw)
In-Reply-To: <20171107200659.21094-1-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e6bfa9f30900..218fb8ba750c 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2413,6 +2413,8 @@ dm_crtc_duplicate_state(struct drm_crtc *crtc)
return NULL;
state = kzalloc(sizeof(*state), GFP_KERNEL);
+ if (!state)
+ return NULL;
__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
@@ -3443,6 +3445,8 @@ create_i2c(struct ddc_service *ddc_service,
struct amdgpu_i2c_adapter *i2c;
i2c = kzalloc(sizeof(struct amdgpu_i2c_adapter), GFP_KERNEL);
+ if (!i2c)
+ return NULL;
i2c->base.owner = THIS_MODULE;
i2c->base.class = I2C_CLASS_DDC;
i2c->base.dev.parent = &adev->pdev->dev;
@@ -3473,6 +3477,11 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
DRM_DEBUG_DRIVER("%s()\n", __func__);
i2c = create_i2c(link->ddc, link->link_index, &res);
+ if (!i2c) {
+ DRM_ERROR("Failed to create i2c adapter data\n");
+ return -ENOMEM;
+ }
+
aconnector->i2c = i2c;
res = i2c_add_adapter(&i2c->base);
--
2.14.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-11-07 20:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-07 20:06 [PATCH v2 1/3] amdgpu/dc: fix more indentation warnings Ernst Sjöstrand
[not found] ` <20171107200659.21094-1-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-07 20:06 ` Ernst Sjöstrand [this message]
2017-11-07 20:06 ` [PATCH v2 3/3] amdgpu/dc: Fix missing null checks in amdgpu_dm.c Ernst Sjöstrand
[not found] ` <20171107200659.21094-3-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-07 20:52 ` Harry Wentland
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=20171107200659.21094-2-ernstp@gmail.com \
--to=ernstp-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/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