[media] coda: improve safety in coda_register_device()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 8 Jan 2015 10:07:08 +0000 (07:07 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 27 Jan 2015 12:15:07 +0000 (10:15 -0200)
commit88ca3af44beb281979e3f037d167cc3fec68c9de
tree288733b781ab030af73fc1352db3ff4ac7b1ce9d
parent35655bf85473abae9ff76f25ec6b321f9935c7bc
[media] coda: improve safety in coda_register_device()

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 any funny
characters and also to stop static checkers from complaining.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/coda/coda-common.c