Skip to content

Commit 5d60122

Browse files
palimchehab
authored andcommitted
[media] radio-bcm2048: fix wrong overflow check
This patch fixes an off by one check in bcm2048_set_region(). Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Pali Rohár <[email protected]> Signed-off-by: Pavel Machek <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Cc: [email protected] Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 9f6be2b commit 5d60122

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/staging/media/bcm2048/radio-bcm2048.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region)
737737
int err;
738738
u32 new_frequency = 0;
739739

740-
if (region > ARRAY_SIZE(region_configs))
740+
if (region >= ARRAY_SIZE(region_configs))
741741
return -EINVAL;
742742

743743
mutex_lock(&bdev->mutex);

0 commit comments

Comments
 (0)