From: "Németh Márton" <nm127@freemail.hu>
To: David Ellingsworth <david@identd.dyndns.org>
Cc: Jean-Francois Moine <moinejf@free.fr>,
linux-media@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gspca: add missing .type field check in VIDIOC_G_PARM
Date: Thu, 19 Mar 2009 06:50:04 +0100 [thread overview]
Message-ID: <49C1DD0C.4050500@freemail.hu> (raw)
In-Reply-To: <30353c3d0903181445i409604e8r33678f7ce09d0288@mail.gmail.com>
David Ellingsworth wrote:
> 2009/3/18 Németh Márton <nm127@freemail.hu>:
>> From: Márton Németh <nm127@freemail.hu>
>>
>> The gspca webcam driver does not check the .type field of struct v4l2_streamparm.
>> This field is an input parameter for the driver according to V4L2 API specification,
>> revision 0.24 [1]. Add the missing check.
>>
>> The missing check was recognised by v4l-test 0.10 [2] together with gspca_sunplus driver
>> and with "Trust 610 LCD POWERC@M ZOOM" webcam. This patch was verified also with
>> v4l-test 0.10.
>>
>> References:
>> [1] V4L2 API specification, revision 0.24
>> http://v4l2spec.bytesex.org/spec/r11680.htm
>>
>> [2] v4l-test: Test environment for Video For Linux Two API
>> http://v4l-test.sourceforge.net/
>>
>> Signed-off-by: Márton Németh <nm127@freemail.hu>
>> ---
>> --- linux-2.6.29-rc8/drivers/media/video/gspca/gspca.c.orig 2009-03-14 12:29:38.000000000 +0100
>> +++ linux-2.6.29-rc8/drivers/media/video/gspca/gspca.c 2009-03-18 16:51:03.000000000 +0100
>> @@ -1320,6 +1320,9 @@ static int vidioc_g_parm(struct file *fi
>> {
>> struct gspca_dev *gspca_dev = priv;
>>
>> + if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
>> + return -EINVAL;
>> +
>> memset(parm, 0, sizeof *parm);
>> parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
> ^^^^^^^^^^^^^^^^^^^
> This line should be deleted as it's no longer needed.
Because memset() clears the whole parm structure this line is necessary. In other
drivers the following code is there:
tmp = parm->type;
memset(parm, 0, sizeof(*parm));
parm->type = parm;
Maybe changing the code similar to this would be easier to read?
Márton Németh
next prev parent reply other threads:[~2009-03-19 5:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 17:48 [PATCH] gspca: add missing .type field check in VIDIOC_G_PARM Németh Márton
2009-03-18 21:45 ` David Ellingsworth
2009-03-19 5:50 ` Németh Márton [this message]
2009-03-19 6:52 ` Németh Márton
2009-03-19 7:34 ` Trent Piepho
2009-03-19 22:14 ` Németh Márton
2009-03-20 0:47 ` Trent Piepho
2009-03-27 10:42 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49C1DD0C.4050500@freemail.hu \
--to=nm127@freemail.hu \
--cc=david@identd.dyndns.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=moinejf@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox