Message ID | 20220228075014.GD13685@kili (mailing list archive) |
---|---|
State | Awaiting Upstream, archived |
Headers | show |
Series | clk: imx: off by one in imx_lpcg_parse_clks_from_dt() | expand |
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 >
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> Applied, thanks! > --- > 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 >
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;
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> --- drivers/clk/imx/clk-imx8qxp-lpcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)