[media] exynos4-is: Fix off-by-one valid range checking for is->config_index
authorAxel Lin <axel.lin@ingics.com>
Tue, 30 Apr 2013 13:18:23 +0000 (10:18 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 21 May 2013 11:37:11 +0000 (08:37 -0300)
Current code uses is->config_index as array subscript, thus the valid value
range is 0 ... ARRAY_SIZE(cmd) - 1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/exynos4-is/fimc-is-regs.c

index b0ff67bc1b056647ecfcc7b3acc5812a9b0408ab..d05eaa2c84909cd5b78430030b2baeef005335c9 100644 (file)
@@ -174,7 +174,7 @@ int fimc_is_hw_change_mode(struct fimc_is *is)
                HIC_CAPTURE_STILL, HIC_CAPTURE_VIDEO,
        };
 
-       if (WARN_ON(is->config_index > ARRAY_SIZE(cmd)))
+       if (WARN_ON(is->config_index >= ARRAY_SIZE(cmd)))
                return -EINVAL;
 
        mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0));