Skip to content

Commit 135efc3

Browse files
Dan Carpenterabelvesa
authored andcommitted
clk: imx: off by one in imx_lpcg_parse_clks_from_dt()
The > needs to be >= to prevent an off by one access. Fixes: d5f1e6a ("clk: imx: imx8qxp-lpcg: add parsing clocks from device tree") Reported-by: kernel test robot <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Abel Vesa <[email protected]> Link: https://lore.kernel.org/r/20220228075014.GD13685@kili Signed-off-by: Abel Vesa <[email protected]>
1 parent 8cf0e06 commit 135efc3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clk/imx/clk-imx8qxp-lpcg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static int imx_lpcg_parse_clks_from_dt(struct platform_device *pdev,
248248

249249
for (i = 0; i < count; i++) {
250250
idx = bit_offset[i] / 4;
251-
if (idx > IMX_LPCG_MAX_CLKS) {
251+
if (idx >= IMX_LPCG_MAX_CLKS) {
252252
dev_warn(&pdev->dev, "invalid bit offset of clock %d\n",
253253
i);
254254
ret = -EINVAL;

0 commit comments

Comments
 (0)