Re: [patch] [media] coda: improve safety in coda_register_device()

2015-01-08 Thread Dan Carpenter
On Thu, Jan 08, 2015 at 12:04:20PM +0100, walter harms wrote: > > @@ -1844,10 +1844,11 @@ static int coda_register_device(struct coda_dev > > *dev, int i) > > { > > struct video_device *vfd = &dev->vfd[i]; > > > > - if (i > ARRAY_SIZE(dev->vfd)) > > + if (i >= dev->devtype->num_vdevs) >

Re: [patch] [media] coda: improve safety in coda_register_device()

2015-01-08 Thread walter harms
Am 08.01.2015 11:07, schrieb Dan Carpenter: > The "i" variable is used as an offset into both the dev->vfd[] and the > dev->devtype->vdevs[] arrays. The second array is smaller so we should > use that as a limit instead of ARRAY_SIZE(dev->vfd). Also the original > check was off by one. > > We

[patch] [media] coda: improve safety in coda_register_device()

2015-01-08 Thread Dan Carpenter
The "i" variable is used as an offset into both the dev->vfd[] and the dev->devtype->vdevs[] arrays. The second array is smaller so we should use that as a limit instead of ARRAY_SIZE(dev->vfd). Also the original check was off by one. We should use a format string as well in case the ->name has