Hi Laurent

On Wed, Apr 25, 2012 at 8:57 AM, Sergio Aguirre <saagui...@ti.com> wrote:
> 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.

Any feedback about this?

Regards,
Sergio

>
> Signed-off-by: Sergio Aguirre <saagui...@ti.com>
> ---
>  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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to