Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1409182 > unrolled thread

[PATCH v1 2/2] lib/uuid.c: use correct offset in uuid parser

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2016-05-30 16:50 +0200
Last post2016-05-30 16:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v1 2/2] lib/uuid.c: use correct offset in uuid parser Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-05-30 16:50 +0200

#1409182 — [PATCH v1 2/2] lib/uuid.c: use correct offset in uuid parser

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2016-05-30 16:50 +0200
Subject[PATCH v1 2/2] lib/uuid.c: use correct offset in uuid parser
Message-ID<rEwFX-5sh-5@gated-at.bofh.it>
From: Bjørn Mork <bjorn@mork.no>

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>
---
 lib/uuid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/uuid.c b/lib/uuid.c
index e116ae5..37687af 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -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;
 	}
-- 
2.8.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web