Re: [PATCH] cdrom: beyond ARRAY_SIZE of viocd_diskinfo

From: Jens Axboe
Date: Wed May 20 2009 - 02:42:50 EST


On Wed, May 20 2009, Roel Kluin wrote:
> Do not go beyond ARRAY_SIZE of viocd_diskinfo

Good catch, applied.

>
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
> ---
> diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
> index 1392935..9b1624e 100644
> --- a/drivers/cdrom/viocd.c
> +++ b/drivers/cdrom/viocd.c
> @@ -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;
>

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/