Commit ef34dd18 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

staging/fwserial: add diagnostic for buffer overflow

Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2257d122
...@@ -577,8 +577,11 @@ static int fwtty_buffer_rx(struct fwtty_port *port, unsigned char *d, size_t n) ...@@ -577,8 +577,11 @@ static int fwtty_buffer_rx(struct fwtty_port *port, unsigned char *d, size_t n)
struct buffered_rx *buf; struct buffered_rx *buf;
size_t size = (n + sizeof(struct buffered_rx) + 0xFF) & ~0xFF; size_t size = (n + sizeof(struct buffered_rx) + 0xFF) & ~0xFF;
if (port->buffered + n > HIGH_WATERMARK) if (port->buffered + n > HIGH_WATERMARK) {
fwtty_err_ratelimited(port, "overflowed rx buffer: buffered: %d new: %ld wtrmk: %d",
port->buffered, n, HIGH_WATERMARK);
return 0; return 0;
}
buf = kmalloc(size, GFP_ATOMIC); buf = kmalloc(size, GFP_ATOMIC);
if (!buf) if (!buf)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment