Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753955Ab0LUXzw (ORCPT ); Tue, 21 Dec 2010 18:55:52 -0500 Received: from casper.infradead.org ([85.118.1.10]:42250 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752862Ab0LUXzv (ORCPT ); Tue, 21 Dec 2010 18:55:51 -0500 Message-ID: <4D113E7C.7000307@infradead.org> Date: Tue, 21 Dec 2010 21:55:40 -0200 From: Mauro Carvalho Chehab User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 MIME-Version: 1.0 To: Thiago Farina CC: Arnd Bergmann , linux-kernel@vger.kernel.org, Guennadi Liakhovetski , linux-media@vger.kernel.org Subject: Re: [PATCH] drivers/media/video/v4l2-compat-ioctl32.c: Check the return value of copy_to_user References: <201012211925.38201.arnd@arndb.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1735 Lines: 40 Em 21-12-2010 16:34, Thiago Farina escreveu: > On Tue, Dec 21, 2010 at 4:25 PM, Arnd Bergmann 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/