From: Pali Rohár Date: Tue, 22 Apr 2014 15:02:39 +0000 (-0300) Subject: [media] radio-bcm2048: fix wrong overflow check X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5d60122b7e30f275593df93b39a76d3c2663cfc2;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [media] radio-bcm2048: fix wrong overflow check This patch fixes an off by one check in bcm2048_set_region(). Reported-by: Dan Carpenter Signed-off-by: Pali Rohár Signed-off-by: Pavel Machek Signed-off-by: Dan Carpenter Signed-off-by: Hans Verkuil Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index b2cd3a85166d..bbf236e842a9 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -737,7 +737,7 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region) int err; u32 new_frequency = 0; - if (region > ARRAY_SIZE(region_configs)) + if (region >= ARRAY_SIZE(region_configs)) return -EINVAL; mutex_lock(&bdev->mutex);