staging/fwserial: add diagnostic for buffer overflow
authorPeter Hurley <peter@hurleysoftware.com>
Tue, 29 Jan 2013 03:34:43 +0000 (22:34 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jan 2013 04:28:45 +0000 (23:28 -0500)
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fwserial/fwserial.c

index 258ac35..fe9a688 100644 (file)
@@ -577,8 +577,11 @@ static int fwtty_buffer_rx(struct fwtty_port *port, unsigned char *d, size_t n)
        struct buffered_rx *buf;
        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;
+       }
        buf = kmalloc(size, GFP_ATOMIC);
        if (!buf)
                return 0;