Otherwise, some false positives might arise when having 2 subdevices with similar names, like: "OMAP4 ISS ISP IPIPEIF" "OMAP4 ISS ISP IPIPE" Before this patch, trying to find "OMAP4 ISS ISP IPIPE", resulted in a false entity match, retrieving "OMAP4 ISS ISP IPIPEIF" information instead. Checking length should ensure such cases are handled well. Signed-off-by: Sergio Aguirre <saaguirre@xxxxxx> --- src/mediactl.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/mediactl.c b/src/mediactl.c index 5b8c587..451a386 100644 --- a/src/mediactl.c +++ b/src/mediactl.c @@ -66,7 +66,8 @@ struct media_entity *media_get_entity_by_name(struct media_device *media, for (i = 0; i < media->entities_count; ++i) { struct media_entity *entity = &media->entities[i]; - if (strncmp(entity->info.name, name, length) == 0) + if ((strncmp(entity->info.name, name, length) == 0) && + (strlen(entity->info.name) == length)) return entity; } -- 1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html