Németh Márton wrote:
> 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.
Sorry, this is the right patch, without modifying the Makefile.
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