HID: picoLCD: bounds check in dump_buff_as_hex()
authorBruno Prémont <bonbons@linux-vserver.org>
Wed, 19 Sep 2012 19:18:10 +0000 (21:18 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 24 Sep 2012 21:04:55 +0000 (23:04 +0200)
commit5ed84c341c25accc61410cfb53a45170f8fb19e4
treeba7df0b10aafff90cdcedf8307803c0da8e25339
parent206e3f1cda4d6113bdbb3656917d481b9ad447e4
HID: picoLCD: bounds check in dump_buff_as_hex()

Make sure we keep enough space for terminating NUL character after last
newline. If we have too much data, replace last byte with '.'s to
make overflow visible.

Using hex_dump_to_buffer() is not interesting as it adds more overhead
and does not append the trailing linefeed.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-picolcd_debugfs.c