From: Dan Carpenter <dan.carpenter@oracle.com> To: Michael Turquette <mturquette@baylibre.com>, Chao Xie <chao.xie@marvell.com> Cc: Stephen Boyd <sboyd@kernel.org>, linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] clk: mmp: Off by one in mmp_clk_add() Date: Mon, 03 Dec 2018 14:51:43 +0000 [thread overview] Message-ID: <20181203145143.qogc62x7ftx4zv4l@kili.mountain> (raw) The > comparison should be >= or we write one element beyond the end of the unit->clk_table[] array. (The unit->clk_table[] array is allocated in the mmp_clk_init() function and it has unit->nr_clks elements). Fixes: 4661fda10f8b ("clk: mmp: add basic support functions for DT support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- drivers/clk/mmp/clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/mmp/clk.c b/drivers/clk/mmp/clk.c index ad8d483a35cd..ca7d37e2c7be 100644 --- a/drivers/clk/mmp/clk.c +++ b/drivers/clk/mmp/clk.c @@ -183,7 +183,7 @@ void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id, pr_err("CLK %d has invalid pointer %p\n", id, clk); return; } - if (id > unit->nr_clks) { + if (id >= unit->nr_clks) { pr_err("CLK %d is invalid\n", id); return; } -- 2.11.0
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: Michael Turquette <mturquette@baylibre.com>, Chao Xie <chao.xie@marvell.com> Cc: Stephen Boyd <sboyd@kernel.org>, linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] clk: mmp: Off by one in mmp_clk_add() Date: Mon, 3 Dec 2018 17:51:43 +0300 [thread overview] Message-ID: <20181203145143.qogc62x7ftx4zv4l@kili.mountain> (raw) The > comparison should be >= or we write one element beyond the end of the unit->clk_table[] array. (The unit->clk_table[] array is allocated in the mmp_clk_init() function and it has unit->nr_clks elements). Fixes: 4661fda10f8b ("clk: mmp: add basic support functions for DT support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- drivers/clk/mmp/clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/mmp/clk.c b/drivers/clk/mmp/clk.c index ad8d483a35cd..ca7d37e2c7be 100644 --- a/drivers/clk/mmp/clk.c +++ b/drivers/clk/mmp/clk.c @@ -183,7 +183,7 @@ void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id, pr_err("CLK %d has invalid pointer %p\n", id, clk); return; } - if (id > unit->nr_clks) { + if (id >= unit->nr_clks) { pr_err("CLK %d is invalid\n", id); return; } -- 2.11.0
next reply other threads:[~2018-12-03 14:51 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-12-03 14:51 Dan Carpenter [this message] 2018-12-03 14:51 ` [PATCH] clk: mmp: Off by one in mmp_clk_add() Dan Carpenter 2018-12-03 17:55 ` Stephen Boyd 2018-12-03 17:55 ` Stephen Boyd
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=20181203145143.qogc62x7ftx4zv4l@kili.mountain \ --to=dan.carpenter@oracle.com \ --cc=chao.xie@marvell.com \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-clk@vger.kernel.org \ --cc=mturquette@baylibre.com \ --cc=sboyd@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: linkBe 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.