diff options
Diffstat (limited to 'lib/hexdump.c')
-rw-r--r-- | lib/hexdump.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/hexdump.c b/lib/hexdump.c index 7ea09699855d..8d74c20d8595 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/ctype.h> | 11 | #include <linux/ctype.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/export.h> | 13 | #include <linux/export.h> |
14 | #include <asm/unaligned.h> | ||
14 | 15 | ||
15 | const char hex_asc[] = "0123456789abcdef"; | 16 | const char hex_asc[] = "0123456789abcdef"; |
16 | EXPORT_SYMBOL(hex_asc); | 17 | EXPORT_SYMBOL(hex_asc); |
@@ -139,7 +140,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, | |||
139 | for (j = 0; j < ngroups; j++) { | 140 | for (j = 0; j < ngroups; j++) { |
140 | ret = snprintf(linebuf + lx, linebuflen - lx, | 141 | ret = snprintf(linebuf + lx, linebuflen - lx, |
141 | "%s%16.16llx", j ? " " : "", | 142 | "%s%16.16llx", j ? " " : "", |
142 | (unsigned long long)*(ptr8 + j)); | 143 | get_unaligned(ptr8 + j)); |
143 | if (ret >= linebuflen - lx) | 144 | if (ret >= linebuflen - lx) |
144 | goto overflow1; | 145 | goto overflow1; |
145 | lx += ret; | 146 | lx += ret; |
@@ -150,7 +151,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, | |||
150 | for (j = 0; j < ngroups; j++) { | 151 | for (j = 0; j < ngroups; j++) { |
151 | ret = snprintf(linebuf + lx, linebuflen - lx, | 152 | ret = snprintf(linebuf + lx, linebuflen - lx, |
152 | "%s%8.8x", j ? " " : "", | 153 | "%s%8.8x", j ? " " : "", |
153 | *(ptr4 + j)); | 154 | get_unaligned(ptr4 + j)); |
154 | if (ret >= linebuflen - lx) | 155 | if (ret >= linebuflen - lx) |
155 | goto overflow1; | 156 | goto overflow1; |
156 | lx += ret; | 157 | lx += ret; |
@@ -161,7 +162,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, | |||
161 | for (j = 0; j < ngroups; j++) { | 162 | for (j = 0; j < ngroups; j++) { |
162 | ret = snprintf(linebuf + lx, linebuflen - lx, | 163 | ret = snprintf(linebuf + lx, linebuflen - lx, |
163 | "%s%4.4x", j ? " " : "", | 164 | "%s%4.4x", j ? " " : "", |
164 | *(ptr2 + j)); | 165 | get_unaligned(ptr2 + j)); |
165 | if (ret >= linebuflen - lx) | 166 | if (ret >= linebuflen - lx) |
166 | goto overflow1; | 167 | goto overflow1; |
167 | lx += ret; | 168 | lx += ret; |