diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-01-20 17:58:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-20 20:09:18 -0500 |
commit | 7047d813718c8e40929b7267a8d20cbf212f8565 (patch) | |
tree | 7da361cc2cc4638e856109d646154470b7236d4b /lib | |
parent | ad27a7559a85309a4775389d012f3728c92f5eb0 (diff) |
test_hexdump: switch to memcmp()
Better to use memcmp() against entire buffer to check that nothing is
happened to the data in the tail.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test_hexdump.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/test_hexdump.c b/lib/test_hexdump.c index 141d031e6a13..4b949aac6f08 100644 --- a/lib/test_hexdump.c +++ b/lib/test_hexdump.c | |||
@@ -72,8 +72,6 @@ static void __init test_hexdump_prepare_test(size_t len, int rowsize, | |||
72 | else | 72 | else |
73 | result = test_data_1_le; | 73 | result = test_data_1_le; |
74 | 74 | ||
75 | memset(test, FILL_CHAR, testlen); | ||
76 | |||
77 | /* hex dump */ | 75 | /* hex dump */ |
78 | p = test; | 76 | p = test; |
79 | for (i = 0; i < l / gs; i++) { | 77 | for (i = 0; i < l / gs; i++) { |
@@ -109,13 +107,15 @@ static void __init test_hexdump(size_t len, int rowsize, int groupsize, | |||
109 | char test[TEST_HEXDUMP_BUF_SIZE]; | 107 | char test[TEST_HEXDUMP_BUF_SIZE]; |
110 | char real[TEST_HEXDUMP_BUF_SIZE]; | 108 | char real[TEST_HEXDUMP_BUF_SIZE]; |
111 | 109 | ||
110 | memset(real, FILL_CHAR, sizeof(real)); | ||
112 | hex_dump_to_buffer(data_b, len, rowsize, groupsize, real, sizeof(real), | 111 | hex_dump_to_buffer(data_b, len, rowsize, groupsize, real, sizeof(real), |
113 | ascii); | 112 | ascii); |
114 | 113 | ||
114 | memset(test, FILL_CHAR, sizeof(test)); | ||
115 | test_hexdump_prepare_test(len, rowsize, groupsize, test, sizeof(test), | 115 | test_hexdump_prepare_test(len, rowsize, groupsize, test, sizeof(test), |
116 | ascii); | 116 | ascii); |
117 | 117 | ||
118 | if (strcmp(test, real)) { | 118 | if (memcmp(test, real, TEST_HEXDUMP_BUF_SIZE)) { |
119 | pr_err("Len: %zu row: %d group: %d\n", len, rowsize, groupsize); | 119 | pr_err("Len: %zu row: %d group: %d\n", len, rowsize, groupsize); |
120 | pr_err("Result: '%s'\n", real); | 120 | pr_err("Result: '%s'\n", real); |
121 | pr_err("Expect: '%s'\n", test); | 121 | pr_err("Expect: '%s'\n", test); |