[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH for-4.12] dt: fix integer check in dt_device_is_compatible
cplen is unsigned, thus, it can never be < 0. Use a signed integer local variable instead. Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx> --- xen/common/device_tree.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 8fc401d..df274cc 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -213,17 +213,20 @@ bool_t dt_device_is_compatible(const struct dt_device_node *device, { const char* cp; u32 cplen, l; + s64 ilen; cp = dt_get_property(device, "compatible", &cplen); if ( cp == NULL ) return 0; - while ( cplen > 0 ) + + ilen = cplen; + while ( ilen > 0 ) { if ( dt_compat_cmp(cp, compat) == 0 ) return 1; l = strlen(cp) + 1; cp += l; - cplen -= l; + ilen -= l; } return 0; -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |