]> xenbits.xensource.com Git - xen.git/commitdiff
tmem: Parse UUIDs correctly.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Sun, 19 Mar 2017 12:22:05 +0000 (08:22 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 5 Apr 2017 13:39:56 +0000 (09:39 -0400)
A simple
xl tmem-shared-auth -u 00000000-0000-000A-0000-000000000001 -A 0 0

resulted in uuid_low = 1 (correct) and uuid_high = 0 (umm?).

The issue was that for hex values above 'A' (or 'a') we forgot
to add 10.

Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
tools/libxc/xc_tmem.c

index 5f5e18fcff1f1feac8a29c3f1b33473163241ad0..9bf5cc3cf464d9fabca3f0cc56df4d4358d50e19 100644 (file)
@@ -138,9 +138,9 @@ static int xc_tmem_uuid_parse(char *uuid_str, uint64_t *uuid_lo, uint64_t *uuid_
         else if ( *p >= '0' && *p <= '9' )
             digit = *p - '0';
         else if ( *p >= 'A' && *p <= 'F' )
-            digit = *p - 'A';
+            digit = *p - 'A' + 10;
         else if ( *p >= 'a' && *p <= 'f' )
-            digit = *p - 'a';
+            digit = *p - 'a' + 10;
         else
             return -1;
         *x = (*x << 4) | digit;