On Thu, 2007-11-29 at 22:07 +0100, Jan Engelhardt wrote:
> I'd add GFP_ATOMIC here. Who knows whether tomorrow, the oops dumper
> or warn_on will use print_hex_dump.
Signed-off-by: Joe Perches <[email protected]>
diff --git a/lib/hexdump.c b/lib/hexdump.c
index 70e23fb..be94934 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -140,13 +140,20 @@ EXPORT_SYMBOL(hex_dump_to_buffer);
* Example output using %DUMP_PREFIX_ADDRESS and 4-byte mode:
* ffffffff88089af0: 73727170 77767574 7b7a7978 7f7e7d7c pqrstuvwxyz{|}~.
*/
+
+#define HEX_LINE_SIZE 200
+
void print_hex_dump(const char *level, const char *prefix_str, int prefix_type,
int rowsize, int groupsize,
const void *buf, size_t len, bool ascii)
{
const u8 *ptr = buf;
int i, linelen, remaining = len;
- unsigned char linebuf[200];
+ unsigned char *linebuf;
+
+ linebuf = kmalloc(HEX_LINE_SIZE, GFP_ATOMIC);
+ if (!linebuf) {
+ WARN_ON(1);
+ return;
+ }
if (rowsize != 16 && rowsize != 32)
rowsize = 16;
@@ -155,7 +162,7 @@ void print_hex_dump(const char *level, const char *prefix_str, int prefix_type,
linelen = min(remaining, rowsize);
remaining -= rowsize;
hex_dump_to_buffer(ptr + i, linelen, rowsize, groupsize,
- linebuf, sizeof(linebuf), ascii);
+ linebuf, HEX_LINE_SIZE, ascii);
switch (prefix_type) {
case DUMP_PREFIX_ADDRESS:
@@ -170,6 +177,7 @@ void print_hex_dump(const char *level, const char *prefix_str, int prefix_type,
break;
}
}
+ kfree(linebuf);
}
EXPORT_SYMBOL(print_hex_dump);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]