提交 b7de567b 编写于 作者: J Jonathan Corbet 提交者: Linus Torvalds

[PATCH] VIDIOC_ENUMSTD bug

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: NJonathan Corbet <corbet@lwn.net>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: <stable@kernel.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 1cc5f714
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册