public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] video: ipu: Fix dereferencing NULL pointer problem
@ 2018-01-02  7:25 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:20 ` [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem Anatolij Gustschin
  0 siblings, 2 replies; 5+ messages in thread
From: Peng Fan @ 2018-01-02  7:25 UTC (permalink / raw)
  To: u-boot

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>
---
 drivers/video/ipu_common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
index 96229da502..b3b09e6982 100644
--- a/drivers/video/ipu_common.c
+++ b/drivers/video/ipu_common.c
@@ -134,6 +134,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 {
 	if (clk && clk->set_rate)
 		clk->set_rate(clk, rate);
+
+	if (!clk)
+		return 0;
+
 	return clk->rate;
 }
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-03 11:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem Anatolij Gustschin
2018-01-03 11:33   ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox