Márton Németh wrote:
> The argument of VIDIOC_S_INPUT is __u32 according to
> http://v4l2spec.bytesex.org/spec/r11217.htm . The documentation
> only says that a pointer to a number should be passed, and this
> number should be "as in the struct v4l2_input index field". The
> index field there has __u32 type.
>
> This change prevents the following condition to fail:
>
> if (*index >= MAX_EM28XX_INPUT)
> return -EINVAL;
>
> Imagine for example if index is signed: index=0x80000000=-2147483648,
> then the condition above won't return -EINVAL.
The type should be __u32 not only for VIDIOC_S_INPUT, but also
for VIDIOC_G_INPUT and VIDIOC_ENUMINPUT.
diff -r 932738881388 Makefile
--- a/Makefile Thu Dec 11 09:33:26 2008 +0100
+++ b/Makefile Mon Dec 15 22:46:12 2008 +0100
@@ -55,6 +55,8 @@
OLDMOD := /lib/modules/$(KVER)/kernel/drivers/media/video/em28xx/em28xx.ko # real modules dir
EXTRA_CFLAGS += -I$(PWD)/include -I$(SDIR)/drivers/media/video -I$(SDIR)/drivers/media/dvb/frontends -I$(SDIR)/drivers/media/dvb/dvb-core -I$(SDIR)/drivers/media/tuners/ -Iinclude/linux -Idrivers/media/video -Idrivers/media/dvb/frontends -Idrivers/media/dvb/dvb-core -Idrivers/media/tuners/ -Iinclude/linux -Wall -DCONFIG_DVB_ZL10353 -DCONFIG_DVB_DRX3973D -DDRXD_TYPE_B -DDRXD_TYPE_A -DCONFIG_DVB_LGDT3304 -DCONFIG_MEDIA_TUNER_QT1010 -DCONFIG_DVB_TUNER_MT2060 -DCONFIG_DVB_S921
+#EXTRA_CFLAGS += $(GCOV_FLAGS)
+EXTRA_CFLAGS += -fprofile-arcs -ftest-coverage
export EXTRA_CFLAGS
KDIR := /lib/modules/$(KVER)/build
diff -r 932738881388 em28xx-video.c
--- a/em28xx-video.c Thu Dec 11 09:33:26 2008 +0100
+++ b/em28xx-video.c Mon Dec 15 22:46:12 2008 +0100
@@ -440,7 +440,7 @@
}
-static void video_mux(struct em28xx *dev, int index)
+static void video_mux(struct em28xx *dev, __u32 index)
{
int input = INPUT(index)->vmux;
struct v4l2_routing route;
@@ -2014,7 +2014,7 @@
case VIDIOC_ENUMINPUT:
{
struct v4l2_input *i = arg;
- unsigned int n;
+ __u32 n;
static const char *iname[] = {
[EM28XX_VMUX_COMPOSITE1] = "Composite1",
[EM28XX_VMUX_COMPOSITE2] = "Composite2",
@@ -2045,14 +2045,14 @@
}
case VIDIOC_G_INPUT:
{
- int *i = arg;
+ __u32 *i = arg;
*i = dev->ctl_input;
return 0;
}
case VIDIOC_S_INPUT:
{
- int *index = arg;
+ __u32 *index = arg;
if (*index >= MAX_EM28XX_INPUT)
return -EINVAL;
_______________________________________________
Em28xx mailing list
[email protected]
http://mcentral.de/mailman/listinfo/em28xx