summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodor Tomov <ttomov@mm-sol.com>2011-01-04 11:49:55 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-01-04 23:28:10 +0100
commit6971cf795cfefed91bba87c76eee0e8a28d22b7c (patch)
treeb4093bd1e341d50d337bff8032a43ef15fb2d61f
parent44c981d39215a5b78f077ab758b41c6e0e8a73ef (diff)
media.c: fix array overrun in media_entity_subtype_to_string()
Fix overrun of static arrays node_types and subdev_types in media_entity_subtype_to_string(). Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
-rw-r--r--media.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/media.c b/media.c
index 813a38f..75ca24c 100644
--- a/media.c
+++ b/media.c
@@ -82,12 +82,12 @@ static const char *media_entity_subtype_to_string(unsigned type)
switch (type & MEDIA_ENTITY_TYPE_MASK) {
case MEDIA_ENTITY_TYPE_NODE:
- if (subtype > ARRAY_SIZE(node_types))
+ if (subtype >= ARRAY_SIZE(node_types))
subtype = 0;
return node_types[subtype];
case MEDIA_ENTITY_TYPE_SUBDEV:
- if (subtype > ARRAY_SIZE(subdev_types))
+ if (subtype >= ARRAY_SIZE(subdev_types))
subtype = 0;
return subdev_types[subtype];
default: