All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ernst Sjöstrand" <ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH v2] amd/display: Fix potential null dereference in dce_calcs.c
Date: Wed,  8 Nov 2017 22:47:06 +0100	[thread overview]
Message-ID: <20171108214706.5579-1-ernstp@gmail.com> (raw)

Reported by smatch:
bw_calcs() error: potential null dereference 'data'

Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
---
I couldn't use DC_ERROR because the dc_context had the wrong variable
name. Seems like a larger project to fix...

 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
index 4f8a95368ffc..6347712db834 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
+++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
@@ -2794,6 +2794,8 @@ bool bw_calcs(struct dc_context *ctx,
 {
 	struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data),
 					     GFP_KERNEL);
+	if (!data)
+		return false;
 
 	populate_initial_data(pipe, pipe_count, data);
 
-- 
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2017-11-08 21:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08 21:47 Ernst Sjöstrand [this message]
     [not found] ` <20171108214706.5579-1-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-08 22:05   ` [PATCH v2] amd/display: Fix potential null dereference in dce_calcs.c 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=20171108214706.5579-1-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 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.