From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Thiago Farina <tfransosi@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
linux-media@vger.kernel.org
Subject: Re: [PATCH] drivers/media/video/v4l2-compat-ioctl32.c: Check the return value of copy_to_user
Date: Tue, 21 Dec 2010 21:55:40 -0200 [thread overview]
Message-ID: <4D113E7C.7000307@infradead.org> (raw)
In-Reply-To: <AANLkTikbvST_B+4x3Xt=gxFhM1TBOrXVc1HjZT3zTXrt@mail.gmail.com>
Em 21-12-2010 16:34, Thiago Farina escreveu:
> On Tue, Dec 21, 2010 at 4:25 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> On Tuesday 21 December 2010 02:18:06 Thiago Farina wrote:
>>> diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c
>>> index e30e8df..55825ec 100644
>>> --- a/drivers/media/video/v4l2-compat-ioctl32.c
>>> +++ b/drivers/media/video/v4l2-compat-ioctl32.c
>>> @@ -206,7 +206,9 @@ static struct video_code __user *get_microcode32(struct video_code32 *kp)
>>> * user address is invalid, the native ioctl will do
>>> * the error handling for us
>>> */
>>> - (void) copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat));
>>> + if (copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat)))
>>> + return NULL;
>>> +
>>> (void) put_user(kp->datasize, &up->datasize);
>>> (void) put_user(compat_ptr(kp->data), &up->data);
>>> return up;
>>
>> Did you read the comment above the code you changed?
>>
> Yes, I read, but I went ahead.
>
>> You can probably change this function to look at the return code of
>> copy_to_user, but then you need to treat the put_user return code
>> the same, and change the comment.
>>
>
> Right, I will do the same with put_user, but I'm afraid of changing the comment.
Well, we should just remove all V4L1 stuff for .38, so I don't see much sense on keeping
the VIDIOCGMICROCODE32 compat stuff.
Cheers,
Mauro
prev parent reply other threads:[~2010-12-21 23:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-21 1:18 [PATCH] drivers/media/video/v4l2-compat-ioctl32.c: Check the return value of copy_to_user Thiago Farina
2010-12-21 18:25 ` Arnd Bergmann
2010-12-21 18:34 ` Thiago Farina
2010-12-21 19:03 ` Arnd Bergmann
2010-12-21 23:48 ` [PATCH v2] " Thiago Farina
2010-12-22 14:14 ` Andreas Oberritter
2010-12-22 15:50 ` Arnd Bergmann
2010-12-21 23:55 ` Mauro Carvalho Chehab [this message]
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=4D113E7C.7000307@infradead.org \
--to=mchehab@infradead.org \
--cc=arnd@arndb.de \
--cc=g.liakhovetski@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=tfransosi@gmail.com \
/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