From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem
Date: Wed, 3 Jan 2018 12:20:49 +0100 [thread overview]
Message-ID: <20180103112049.4504-1-agust@denx.de> (raw)
In-Reply-To: <1514877937-24144-1-git-send-email-peng.fan@nxp.com>
From: Peng Fan <peng.fan@nxp.com>
The clk_set_rate function dereferences the clk pointer without
checking whether it is NULL. This may cause problem when clk is NULL.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Changes in v2:
- move the NULL check to top of function
drivers/video/ipu_common.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
index 96229da502..889085aa76 100644
--- a/drivers/video/ipu_common.c
+++ b/drivers/video/ipu_common.c
@@ -132,8 +132,12 @@ struct clk *clk_get_parent(struct clk *clk)
int clk_set_rate(struct clk *clk, unsigned long rate)
{
- if (clk && clk->set_rate)
+ if (!clk)
+ return 0;
+
+ if (clk->set_rate)
clk->set_rate(clk, rate);
+
return clk->rate;
}
--
2.11.0
next prev parent reply other threads:[~2018-01-03 11:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-02 7:25 [U-Boot] [PATCH 1/2] video: ipu: Fix dereferencing NULL pointer problem Peng Fan
2018-01-02 7:25 ` [U-Boot] [PATCH 2/2] video: Support multiple lines version string display Peng Fan
2018-01-03 11:31 ` Anatolij Gustschin
2018-01-03 11:20 ` Anatolij Gustschin [this message]
2018-01-03 11:33 ` [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem Anatolij Gustschin
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=20180103112049.4504-1-agust@denx.de \
--to=agust@denx.de \
--cc=u-boot@lists.denx.de \
/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