]> git.baikalelectronics.ru Git - kernel.git/commitdiff
lib/uuid.c: use correct offset in uuid parser
authorBjørn Mork <bjorn@mork.no>
Mon, 30 May 2016 14:40:42 +0000 (17:40 +0300)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 30 May 2016 22:26:57 +0000 (15:26 -0700)
Use '+ 0' and '+ 1' as offsets, like they were intended, instead of
adding to the result.

Fixes: 2b1b0d66704a ("lib/uuid.c: introduce a few more generic helpers")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/uuid.c

index e116ae5fa00f2b417fe0bc6efe6452454873858e..37687af77ff847aeb47f88c8ea5d9b6cda8ac5b3 100644 (file)
@@ -106,8 +106,8 @@ static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16])
                return -EINVAL;
 
        for (i = 0; i < 16; i++) {
-               int hi = hex_to_bin(uuid[si[i]] + 0);
-               int lo = hex_to_bin(uuid[si[i]] + 1);
+               int hi = hex_to_bin(uuid[si[i] + 0]);
+               int lo = hex_to_bin(uuid[si[i] + 1]);
 
                b[ei[i]] = (hi << 4) | lo;
        }