Skip to content

Commit

Permalink
lib/uuid.c: use correct offset in uuid parser
Browse files Browse the repository at this point in the history
Use '+ 0' and '+ 1' as offsets, like they were intended, instead of
adding to the result.

Fixes: 2b1b0d6 ("lib/uuid.c: introduce a few more generic helpers")
Signed-off-by: Bjørn Mork <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
bmork authored and torvalds committed May 30, 2016
1 parent cfaff0e commit bc9dc9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/uuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit bc9dc9d

Please sign in to comment.