public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Abel Vesa <abel.vesa@nxp.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dong Aisheng <aisheng.dong@nxp.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] clk: imx: off by one in imx_lpcg_parse_clks_from_dt()
Date: Mon, 28 Feb 2022 11:28:49 +0200	[thread overview]
Message-ID: <YhyV0R0ELePn2o0N@abelvesa> (raw)
In-Reply-To: <20220228075014.GD13685@kili>

On 22-02-28 10:50:14, Dan Carpenter wrote:
> The > needs to be >= to prevent an off by one access.
> 
> Fixes: d5f1e6a2bb61 ("clk: imx: imx8qxp-lpcg: add parsing clocks from device tree")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Makes sense.

Reviewed-by: Abel Vesa <abel.vesa@nxp.com>

> ---
>  drivers/clk/imx/clk-imx8qxp-lpcg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> index b23758083ce5..5e31a6a24b3a 100644
> --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> @@ -248,7 +248,7 @@ static int imx_lpcg_parse_clks_from_dt(struct platform_device *pdev,
>  
>  	for (i = 0; i < count; i++) {
>  		idx = bit_offset[i] / 4;
> -		if (idx > IMX_LPCG_MAX_CLKS) {
> +		if (idx >= IMX_LPCG_MAX_CLKS) {
>  			dev_warn(&pdev->dev, "invalid bit offset of clock %d\n",
>  				 i);
>  			ret = -EINVAL;
> -- 
> 2.20.1
>

  reply	other threads:[~2022-02-28  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28  7:50 [PATCH] clk: imx: off by one in imx_lpcg_parse_clks_from_dt() Dan Carpenter
2022-02-28  9:28 ` Abel Vesa [this message]
2022-02-28 12:06 ` Abel Vesa

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=YhyV0R0ELePn2o0N@abelvesa \
    --to=abel.vesa@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=dan.carpenter@oracle.com \
    --cc=festevam@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=mturquette@baylibre.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox