summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-01-28 22:34:43 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-29 23:28:45 -0500
commitef34dd184d58824f1cde7402afa8ba2a957029d9 (patch)
treea9e023a19c23f99c85223530bcf689e452ee7ea7
parent2257d1224fa93875d472c21195b7817b0d7bcc50 (diff)
staging/fwserial: add diagnostic for buffer overflow
Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/fwserial/fwserial.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
index 258ac35fb5af..fe9a68854452 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -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;