Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fb: adv7393: off by one in probe function

This should be >= instead of >. It's a little bit clearer if we just
get rid of the temporary variable and just use ARRAY_SIZE() directly.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Dan Carpenter and committed by
Tomi Valkeinen
ee65e182 d4b9efa3

+1 -2
+1 -2
drivers/video/fbdev/bfin_adv7393fb.c
··· 375 375 { 376 376 int ret = 0; 377 377 struct proc_dir_entry *entry; 378 - int num_modes = ARRAY_SIZE(known_modes); 379 378 380 379 struct adv7393fb_device *fbdev = NULL; 381 380 ··· 383 384 return -EINVAL; 384 385 } 385 386 386 - if (mode > num_modes) { 387 + if (mode >= ARRAY_SIZE(known_modes)) { 387 388 dev_err(&client->dev, "mode %d: not supported", mode); 388 389 return -EFAULT; 389 390 }