[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTikbvST_B+4x3Xt=gxFhM1TBOrXVc1HjZT3zTXrt@mail.gmail.com>
Date: Tue, 21 Dec 2010 16:34:04 -0200
From: Thiago Farina <tfransosi@...il.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: linux-kernel@...r.kernel.org,
Guennadi Liakhovetski <g.liakhovetski@....de>,
Mauro Carvalho Chehab <mchehab@...radead.org>,
linux-media@...r.kernel.org
Subject: Re: [PATCH] drivers/media/video/v4l2-compat-ioctl32.c: Check the
return value of copy_to_user
On Tue, Dec 21, 2010 at 4:25 PM, Arnd Bergmann <arnd@...db.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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists