lib/uuid: add a test module
Subsystems (2)
Andy Shevchenko
reviewerPATCH 1/2 lib/uuid: add a test module
It appears that somehow I missed a test of the latest UUID rework which landed in the kernel. Present a small test module to avoid such cases in the future.
Signed-off-by Andy Shevchenko <[email protected]>
--- lib/Kconfig.debug | 3 ++ lib/Makefile | 1 + lib/test_uuid.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 lib/test_uuid.c
lib/Kconfig.debug +3 -0
@@ -1856,6 +1856,9 @@ config TEST_BITMAP If unsure, say N. +config TEST_UUID + tristate "Test functions located in the uuid module at runtime" + config TEST_RHASHTABLE tristate "Perform selftest on resizable hash table" default n
lib/Makefile +1 -0
@@ -58,6 +58,7 @@ obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o obj-$(CONFIG_TEST_PRINTF) += test_printf.o obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o +obj-$(CONFIG_TEST_UUID) += test_uuid.o ifeq ($(CONFIG_DEBUG_KOBJECT),y) CFLAGS_kobject.o += -DDEBUG
lib/test_uuid.c new file +133 -0
133 lines not on this page · raw message
Signature · 1 line
2.8.1
Andy Shevchenko
reviewerPATCH 2/2 lib/uuid.c: use correct offset in uuid parser
From: Bjørn Mork <[email protected]>
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 <[email protected]>
Signed-off-by Andy Shevchenko <[email protected]>
--- lib/uuid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/uuid.c +2 -2
@@ -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; }
Signature · 1 line
2.8.1