Skip to contentSkip to conversation

cdrom: beyond ARRAY_SIZE of viocd_diskinfo

PATCH In review Roel Kluin 2 participants 2 messages May 19, 2009 – May 20, 2009

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 cdrom: beyond ARRAY_SIZE of viocd_diskinfo

Do not go beyond ARRAY_SIZE of viocd_diskinfo

---

drivers/cdrom/viocd.c +1 -1
index 1392935..9b1624e 100644
@@ -587,7 +587,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
 	struct device_node *node = vdev->dev.archdata.of_node;
 
 	deviceno = vdev->unit_address;
-	if (deviceno > VIOCD_MAX_CD)
+	if (deviceno >= VIOCD_MAX_CD)
 		return -ENODEV;
 	if (!node)
 		return -ENODEV;
#1 lore raw
Quoted 1 line · Roel Kluin

Do not go beyond ARRAY_SIZE of viocd_diskinfo

Good catch, applied.

Quoted 17 lines

---

drivers/cdrom/viocd.c +1 -1
index 1392935..9b1624e 100644
@@ -587,7 +587,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
 	struct device_node *node = vdev->dev.archdata.of_node;
 
 	deviceno = vdev->unit_address;
-	if (deviceno > VIOCD_MAX_CD)
+	if (deviceno >= VIOCD_MAX_CD)
 		return -ENODEV;
 	if (!node)
 		return -ENODEV;
Signature · 1 line
Jens Axboe