Skip to contentSkip to conversation

2.6.18 VIDIOC_ENUMSTD bug

PATCH Jonathan Corbet 1 participant 1 message Sep 22, 2006 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

The v4l2 API documentation for VIDIOC_ENUMSTD says:

To enumerate all standards applications shall begin at index zero, incrementing by one until the driver returns EINVAL.

The actual code, however, tests the index this way:

               if (index<=0 || index >= vfd->tvnormsize) {
                        ret=-EINVAL;

So any application which passes in index=0 gets EINVAL right off the bat
- and, in fact, this is what happens to mplayer. So I think the following patch is called for, and maybe even appropriate for a 2.6.18.x stable release. Disagreement?

jon

drivers/media/video/videodev.c renamed from k/t/2.6.18-vanilla/drivers/media/video/videodev.c +1 -1
@@ -836,7 +836,7 @@ static int __video_do_ioctl(struct inode
 			break;
 		}
 
-		if (index<=0 || index >= vfd->tvnormsize) {
+		if (index < 0 || index >= vfd->tvnormsize) {
 			ret=-EINVAL;
 			break;
 		}