Stefano Stabellini
2012-Dec-05 19:01 UTC
[PATCH 2/2] xen/arm: use strcmp in device_tree_type_matches
We want to match the exact string rather than the first subset. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- xen/common/device_tree.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index b321d99..3d4a7a9 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -51,7 +51,7 @@ bool_t device_tree_type_matches(const void *fdt, int node, const char *match) if ( prop == NULL ) return 0; - return !strncmp(prop, match, len); + return !strcmp(prop, match); } bool_t device_tree_node_compatible(const void *fdt, int node, const char *match) -- 1.7.2.5
Ian Campbell
2012-Dec-06 09:47 UTC
Re: [PATCH 2/2] xen/arm: use strcmp in device_tree_type_matches
On Wed, 2012-12-05 at 19:01 +0000, Stefano Stabellini wrote:> We want to match the exact string rather than the first subset. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > --- > xen/common/device_tree.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c > index b321d99..3d4a7a9 100644 > --- a/xen/common/device_tree.c > +++ b/xen/common/device_tree.c > @@ -51,7 +51,7 @@ bool_t device_tree_type_matches(const void *fdt, int node, const char *match) > if ( prop == NULL ) > return 0; > > - return !strncmp(prop, match, len); > + return !strcmp(prop, match);fdt_getprop handled lenp == NULL so you can actually get rid of len completely.> } > > bool_t device_tree_node_compatible(const void *fdt, int node, const char *match)