From patchwork Sat May 15 21:17:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 99887 X-Patchwork-Delegate: dougsland@redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4FLIRW3015554 for ; Sat, 15 May 2010 21:18:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755612Ab0EOVSG (ORCPT ); Sat, 15 May 2010 17:18:06 -0400 Received: from mgw1.diku.dk ([130.225.96.91]:46749 "EHLO mgw1.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755520Ab0EOVSE (ORCPT ); Sat, 15 May 2010 17:18:04 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw1.diku.dk (Postfix) with ESMTP id 9331A52C517; Sat, 15 May 2010 23:18:03 +0200 (CEST) Received: from mgw1.diku.dk ([127.0.0.1]) by localhost (mgw1.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6IImCtWXGOP5; Sat, 15 May 2010 23:17:59 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw1.diku.dk (Postfix) with ESMTP id 3865F52C3EF; Sat, 15 May 2010 23:17:59 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id B30486DFD1E; Sat, 15 May 2010 23:10:47 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3767) id 1D88C200BE; Sat, 15 May 2010 23:17:59 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 188F3200BC; Sat, 15 May 2010 23:17:59 +0200 (CEST) Date: Sat, 15 May 2010 23:17:59 +0200 (CEST) From: Julia Lawall To: Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 16/37] drivers/media/video/uvc: Use kmemdup Message-ID: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 15 May 2010 21:18:28 +0000 (UTC) diff -u -p a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c @@ -637,14 +637,13 @@ static int uvc_parse_streaming(struct uv } streaming->header.bControlSize = n; - streaming->header.bmaControls = kmalloc(p*n, GFP_KERNEL); + streaming->header.bmaControls = kmemdup(&buffer[size], p * n, + GFP_KERNEL); if (streaming->header.bmaControls == NULL) { ret = -ENOMEM; goto error; } - memcpy(streaming->header.bmaControls, &buffer[size], p*n); - buflen -= buffer[0]; buffer += buffer[0];