Commit 135efc3a authored by Dan Carpenter's avatar Dan Carpenter Committed by Abel Vesa

clk: imx: off by one in imx_lpcg_parse_clks_from_dt()

The > needs to be >= to prevent an off by one access.

Fixes: d5f1e6a2 ("clk: imx: imx8qxp-lpcg: add parsing clocks from device tree")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarAbel Vesa <abel.vesa@nxp.com>
Link: https://lore.kernel.org/r/20220228075014.GD13685@kiliSigned-off-by: default avatarAbel Vesa <abel.vesa@nxp.com>
parent 8cf0e06a
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment