clk: imx: off by one in imx_lpcg_parse_clks_from_dt()
PATCH 1/1 clk: imx: off by one in imx_lpcg_parse_clks_from_dt()
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 <[email protected]>
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/clk/imx/clk-imx8qxp-lpcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx8qxp-lpcg.c +1 -1
@@ -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 ;
Signature · 1 line
2.20.1
Quoted 5 lines · Dan Carpenter
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 <[email protected]>Signed-off-by Dan Carpenter <[email protected]>
Makes sense.
Reviewed-by Abel Vesa <[email protected]>
Quoted 20 lines
--- drivers/clk/imx/clk-imx8qxp-lpcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/imx/clk-imx8qxp-lpcg.c +1
-1@@ -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 ;Signature · 1 line
2.20.1
Abel Vesa
AppliedQuoted 5 lines · Dan Carpenter
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 <[email protected]>Signed-off-by Dan Carpenter <[email protected]>
Applied, thanks!
Quoted 20 lines
--- drivers/clk/imx/clk-imx8qxp-lpcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/imx/clk-imx8qxp-lpcg.c +1
-1@@ -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 ;Signature · 1 line
2.20.1