Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1444189 > unrolled thread

[patch] fb: adv7393: off by one in probe function

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-07-15 13:10 +0200
Last post2016-07-15 13:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [patch] fb: adv7393: off by one in probe function Dan Carpenter <dan.carpenter@oracle.com> - 2016-07-15 13:10 +0200

#1444189 — [patch] fb: adv7393: off by one in probe function

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-07-15 13:10 +0200
Subject[patch] fb: adv7393: off by one in probe function
Message-ID<rV9ah-6ar-7@gated-at.bofh.it>
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>

diff --git a/drivers/video/fbdev/bfin_adv7393fb.c b/drivers/video/fbdev/bfin_adv7393fb.c
index 8fe41ca..c846021 100644
--- a/drivers/video/fbdev/bfin_adv7393fb.c
+++ b/drivers/video/fbdev/bfin_adv7393fb.c
@@ -373,7 +373,6 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client,
 {
 	int ret = 0;
 	struct proc_dir_entry *entry;
-	int num_modes = ARRAY_SIZE(known_modes);
 
 	struct adv7393fb_device *fbdev = NULL;
 
@@ -382,7 +381,7 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	if (mode > num_modes) {
+	if (mode >= ARRAY_SIZE(known_modes)) {
 		dev_err(&client->dev, "mode %d: not supported", mode);
 		return -EFAULT;
 	}

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web