From patchwork Fri Jul 16 21:29:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 112497 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6GLTxNo031160 for ; Fri, 16 Jul 2010 21:29:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966221Ab0GPV35 (ORCPT ); Fri, 16 Jul 2010 17:29:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1837 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966209Ab0GPV35 (ORCPT ); Fri, 16 Jul 2010 17:29:57 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6GLTvUo019849 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Jul 2010 17:29:57 -0400 Received: from ihatethathostname.lab.bos.redhat.com (ihatethathostname.lab.bos.redhat.com [10.16.43.238]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6GLTtMA000785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 16 Jul 2010 17:29:56 -0400 Received: from ihatethathostname.lab.bos.redhat.com (ihatethathostname.lab.bos.redhat.com [127.0.0.1]) by ihatethathostname.lab.bos.redhat.com (8.14.4/8.14.3) with ESMTP id o6GLTtni019989 for ; Fri, 16 Jul 2010 17:29:55 -0400 Received: (from jarod@localhost) by ihatethathostname.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id o6GLTs9c019988 for linux-media@vger.kernel.org; Fri, 16 Jul 2010 17:29:54 -0400 X-Authentication-Warning: ihatethathostname.lab.bos.redhat.com: jarod set sender to jarod@redhat.com using -f Date: Fri, 16 Jul 2010 17:29:54 -0400 From: Jarod Wilson To: linux-media@vger.kernel.org Subject: [PATCH] IR/lirc: use memdup_user instead of copy_from_user Message-ID: <20100716212953.GA19872@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 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]); Fri, 16 Jul 2010 21:29:59 +0000 (UTC) diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c index afb1ada..ee1f2d4 100644 --- a/drivers/media/IR/ir-lirc-codec.c +++ b/drivers/media/IR/ir-lirc-codec.c @@ -74,14 +74,9 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, if (count > LIRCBUF_SIZE || count % 2 == 0) return -EINVAL; - txbuf = kzalloc(sizeof(int) * LIRCBUF_SIZE, GFP_KERNEL); - if (!txbuf) - return -ENOMEM; - - if (copy_from_user(txbuf, buf, n)) { - ret = -EFAULT; - goto out; - } + txbuf = memdup_user(buf, n); + if (IS_ERR(txbuf)) + return PTR_ERR(txbuf); ir_dev = lirc->ir_dev; if (!ir_dev) {