From 43322faf5fc35df218c942742a577d5abe3eaac8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Tue, 22 Apr 2014 15:57:26 +0300 Subject: [PATCH] radio-bcm2048.c: fix wrong overflow check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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: Jiri Kosina --- drivers/staging/media/bcm2048/radio-bcm2048.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.20.1