aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/jsm/jsm_neo.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-03-17 12:17:28 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-26 23:00:36 +0100
commita666b54adabc7dd40d754671a26996e6c985ae1b (patch)
treeeafdaa1b060e9455efeda541e5feb783f996d764 /drivers/tty/serial/jsm/jsm_neo.c
parentserial: xuartps: Fix check in console_setup(). (diff)
downloadlinux-dev-a666b54adabc7dd40d754671a26996e6c985ae1b.tar.xz
linux-dev-a666b54adabc7dd40d754671a26996e6c985ae1b.zip
serial: jsm: some off by one bugs
"brd->nasync" amd "brd->maxports" are the same. They hold the number of filled out channels in the brd->channels[] array. These tests should be ">=" instead of ">" so that we don't read one element past the end. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/jsm/jsm_neo.c')
-rw-r--r--drivers/tty/serial/jsm/jsm_neo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index 7291c2117daa..932b2accd06f 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -724,7 +724,7 @@ static inline void neo_parse_isr(struct jsm_board *brd, u32 port)
if (!brd)
return;
- if (port > brd->maxports)
+ if (port >= brd->maxports)
return;
ch = brd->channels[port];
@@ -840,7 +840,7 @@ static inline void neo_parse_lsr(struct jsm_board *brd, u32 port)
if (!brd)
return;
- if (port > brd->maxports)
+ if (port >= brd->maxports)
return;
ch = brd->channels[port];
@@ -1180,7 +1180,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
*/
/* Verify the port is in range. */
- if (port > brd->nasync)
+ if (port >= brd->nasync)
continue;
ch = brd->channels[port];