aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2009-10-03 07:26:55 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-30 01:49:17 -0400
commit18eb0893c12898253c18ba23b51a6ea9a07ba4c7 (patch)
tree5fa3b24c55d520a6554f00eaef872c40d24328e7 /drivers/net
parentb0c110ca8e89f2c9cd52ec7fb1b98c5b7aa78496 (diff)
ibmtr: possible Read buffer overflow?
Prevent read outside array bounds. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/tokenring/ibmtr.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index 525bbc5b9c9d..6a3c7510afd9 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -1143,9 +1143,16 @@ static void dir_open_adapter (struct net_device *dev)
1143 } else { 1143 } else {
1144 char **prphase = printphase; 1144 char **prphase = printphase;
1145 char **prerror = printerror; 1145 char **prerror = printerror;
1146 int pnr = err / 16 - 1;
1147 int enr = err % 16 - 1;
1146 DPRINTK("TR Adapter misc open failure, error code = "); 1148 DPRINTK("TR Adapter misc open failure, error code = ");
1147 printk("0x%x, Phase: %s, Error: %s\n", 1149 if (pnr < 0 || pnr >= ARRAY_SIZE(printphase) ||
1148 err, prphase[err/16 -1], prerror[err%16 -1]); 1150 enr < 0 ||
1151 enr >= ARRAY_SIZE(printerror))
1152 printk("0x%x, invalid Phase/Error.", err);
1153 else
1154 printk("0x%x, Phase: %s, Error: %s\n", err,
1155 prphase[pnr], prerror[enr]);
1149 printk(" retrying after %ds delay...\n", 1156 printk(" retrying after %ds delay...\n",
1150 TR_RETRY_INTERVAL/HZ); 1157 TR_RETRY_INTERVAL/HZ);
1151 } 1158 }