diff mbox

[v1,5/5] tmem: Parse UUIDs correctly.

Message ID 1489930872-7823-6-git-send-email-konrad.wilk@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk March 19, 2017, 1:41 p.m. UTC
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.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxc/xc_tmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Wei Liu March 21, 2017, 5:09 p.m. UTC | #1
On Sun, Mar 19, 2017 at 09:41:12AM -0400, Konrad Rzeszutek Wilk wrote:
> 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.
> 
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox

Patch

diff --git a/tools/libxc/xc_tmem.c b/tools/libxc/xc_tmem.c
index 5f5e18f..9bf5cc3 100644
--- a/tools/libxc/xc_tmem.c
+++ b/tools/libxc/xc_tmem.c
@@ -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;