Skip to content

Commit

Permalink
[PATCH] VIDIOC_ENUMSTD bug
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jonathan Corbet authored and Linus Torvalds committed Sep 26, 2006
1 parent 1cc5f71 commit b7de567
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/video/videodev.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
break;
}

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

0 comments on commit b7de567

Please sign in to comment.