tape: beyond ARRAY_SIZE of viocd_diskinfo

Message ID 4A1355D0.80406@gmail.com
State Accepted, archived
Commit a85c8e17587e81e1c82f6f341a81e4c778fa65f6
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

roel kluin May 20, 2009, 12:58 a.m.
Do not go beyond ARRAY_SIZE of tape_device and viotape_unitinfo

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>


diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index ffc9254..042c814 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -867,7 +867,7 @@  static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id)
 	int j;
 	struct device_node *node = vdev->dev.archdata.of_node;
+	if (i >= VIOTAPE_MAX_TAPE)
 		return -ENODEV;
 	if (!node)
 		return -ENODEV;