All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Michael Turquette <mturquette@baylibre.com>,
	Jolly Shah <jolly.shah@xilinx.com>
Cc: Stephen Boyd <sboyd@kernel.org>,
	Michal Simek <michal.simek@xilinx.com>,
	Rajan Vaja <rajan.vaja@xilinx.com>,
	Tejas Patel <tejasp@xilinx.com>,
	linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] clk: zynqmp: Off by one in zynqmp_is_valid_clock()
Date: Mon, 03 Dec 2018 14:52:01 +0000	[thread overview]
Message-ID: <20181203145200.o6gnv5fhuubfgg4u@kili.mountain> (raw)

The > comparison should be >= to prevent reading beyond the end of the
clock[] array.

(The clock[] array is allocated in zynqmp_clk_setup() and has
clock_max_idx elements.)

Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/clk/zynqmp/clkc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
index 297f16a20bfc..f65cc0ff76ab 100644
--- a/drivers/clk/zynqmp/clkc.c
+++ b/drivers/clk/zynqmp/clkc.c
@@ -128,7 +128,7 @@ static const struct zynqmp_eemi_ops *eemi_ops;
  */
 static inline int zynqmp_is_valid_clock(u32 clk_id)
 {
-	if (clk_id > clock_max_idx)
+	if (clk_id >= clock_max_idx)
 		return -ENODEV;
 
 	return clock[clk_id].valid;
-- 
2.11.0

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Michael Turquette <mturquette@baylibre.com>,
	Jolly Shah <jolly.shah@xilinx.com>
Cc: Stephen Boyd <sboyd@kernel.org>,
	Michal Simek <michal.simek@xilinx.com>,
	Rajan Vaja <rajan.vaja@xilinx.com>,
	Tejas Patel <tejasp@xilinx.com>,
	linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] clk: zynqmp: Off by one in zynqmp_is_valid_clock()
Date: Mon, 3 Dec 2018 17:52:01 +0300	[thread overview]
Message-ID: <20181203145200.o6gnv5fhuubfgg4u@kili.mountain> (raw)

The > comparison should be >= to prevent reading beyond the end of the
clock[] array.

(The clock[] array is allocated in zynqmp_clk_setup() and has
clock_max_idx elements.)

Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/clk/zynqmp/clkc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
index 297f16a20bfc..f65cc0ff76ab 100644
--- a/drivers/clk/zynqmp/clkc.c
+++ b/drivers/clk/zynqmp/clkc.c
@@ -128,7 +128,7 @@ static const struct zynqmp_eemi_ops *eemi_ops;
  */
 static inline int zynqmp_is_valid_clock(u32 clk_id)
 {
-	if (clk_id > clock_max_idx)
+	if (clk_id >= clock_max_idx)
 		return -ENODEV;
 
 	return clock[clk_id].valid;
-- 
2.11.0


             reply	other threads:[~2018-12-03 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 14:52 Dan Carpenter [this message]
2018-12-03 14:52 ` [PATCH] clk: zynqmp: Off by one in zynqmp_is_valid_clock() 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=20181203145200.o6gnv5fhuubfgg4u@kili.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=jolly.shah@xilinx.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=mturquette@baylibre.com \
    --cc=rajan.vaja@xilinx.com \
    --cc=sboyd@kernel.org \
    --cc=tejasp@xilinx.com \
    /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.