linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] fbdev: off by one test (harmless)
@ 2014-12-26 17:26 Dan Carpenter
  2014-12-27  1:29 ` Jingoo Han
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Dan Carpenter @ 2014-12-26 17:26 UTC (permalink / raw)
  To: linux-fbdev

ARRAY_SIZE(cea_modes) is 64 so the "idx > 63" test earlier means this
test is really a no-op.  But it's still off by one and upsets the static
checkers so we may as well correct it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 5b0e313..3030269 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -1061,7 +1061,7 @@ void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
 		int idx = svd[i - specs->modedb_len - num];
 		if (!idx || idx > 63) {
 			pr_warning("Reserved SVD code %d\n", idx);
-		} else if (idx > ARRAY_SIZE(cea_modes) || !cea_modes[idx].xres) {
+		} else if (idx >= ARRAY_SIZE(cea_modes) || !cea_modes[idx].xres) {
 			pr_warning("Unimplemented SVD code %d\n", idx);
 		} else {
 			memcpy(&m[i], cea_modes + idx, sizeof(m[i]));

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-08-10  9:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26 17:26 [patch] fbdev: off by one test (harmless) Dan Carpenter
2014-12-27  1:29 ` Jingoo Han
2014-12-29 21:51 ` David Ung
2015-01-13 11:19 ` Tomi Valkeinen
2015-01-14  5:24 ` David Ung
2015-01-15 11:42 ` Tomi Valkeinen
2015-01-15 11:56 ` Tomi Valkeinen
2015-01-15 12:26 ` Dan Carpenter
2015-01-15 12:39 ` Tomi Valkeinen
2015-01-15 12:43 ` Dan Carpenter
2015-01-15 12:52 ` Tomi Valkeinen
2015-07-23 12:39 ` Dan Carpenter
2015-08-10  9:38 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).