From: Dan Carpenter <error27@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [patch] sh: clkfwk: potential null deref in debug code
Date: Sun, 20 Mar 2011 11:12:49 +0000 [thread overview]
Message-ID: <20110320111249.GH2008@bicker> (raw)
This function is designed to accept a NULL for "best_freq" but the
debug code dereferences it unconditionally.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Btw. Smatch complains that "best" could NULL as well, but I don't
know if actually that's possible so I left it as is.
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
index 5f63c3b..dee971c 100644
--- a/drivers/sh/clk/core.c
+++ b/drivers/sh/clk/core.c
@@ -616,7 +616,7 @@ long clk_round_parent(struct clk *clk, unsigned long target,
pr_debug("%u / %lu = %lu, / %lu = %lu, best %lu, parent %u\n",
freq->frequency, div, freq_high, div + 1, freq_low,
- *best_freq, best->frequency);
+ best_freq ? *best_freq : -1, best->frequency);
if (!error)
break;
next reply other threads:[~2011-03-20 11:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-20 11:12 Dan Carpenter [this message]
2011-03-20 15:57 ` [patch] sh: clkfwk: potential null deref in debug code Guennadi Liakhovetski
2011-03-23 13:32 ` Paul Mundt
2011-03-23 14:01 ` Guennadi Liakhovetski
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=20110320111249.GH2008@bicker \
--to=error27@gmail.com \
--cc=linux-sh@vger.kernel.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.