From patchwork Fri Jun 4 15:39:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 104298 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 o54FdRHU016167 for ; Fri, 4 Jun 2010 15:39:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751825Ab0FDPjZ (ORCPT ); Fri, 4 Jun 2010 11:39:25 -0400 Received: from mail-ew0-f223.google.com ([209.85.219.223]:37593 "EHLO mail-ew0-f223.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551Ab0FDPjY (ORCPT ); Fri, 4 Jun 2010 11:39:24 -0400 Received: by ewy23 with SMTP id 23so346556ewy.1 for ; Fri, 04 Jun 2010 08:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=YCbwMADm3AYU2S3tHNrMTHa8RGAiF1U5FTRiiimq9+g=; b=r6pMbm8P39ehM1bvrl6EgJ53oeTr24jc46LLGuGapaT64ApT38n+ohtGwO4xWnj5vU J9VBLuwmDprG5autXHIuuJE6Qjxbo1JNFuan372A40fOOchxZlP6SsrAImkK3NcLjBQl WzWKs2ELekvIzVPwRGa/ECRb/d21mHIMXNDL4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=ms6qJnGHYIJHGZe0FMTAYOxfNwDsi/CxvkQKoe+RaTgtcoEa7+YwuFGAyh6Jnkvwql vwKdRAv3rqTOxGu+NxHZZqJ/HgvYdOiGjU9SWqGE8QqXouV0fulXIhHe6laH02Fcd/DQ V9T7+fkzaStfj2V4HdFah+YlUMJN5Oe4gf0Uo= Received: by 10.213.31.143 with SMTP id y15mr3418287ebc.14.1275665960461; Fri, 04 Jun 2010 08:39:20 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id 13sm788388ewy.13.2010.06.04.08.39.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 04 Jun 2010 08:39:19 -0700 (PDT) Date: Fri, 4 Jun 2010 17:39:03 +0200 From: Dan Carpenter To: walter harms Cc: Mauro Carvalho Chehab , Frederic Weisbecker , Arnd Bergmann , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch v2] V4L/DVB: dvb_ca_en50221: return -EFAULT on copy_to_user errors Message-ID: <20100604153903.GH5483@bicker> References: <20100604103629.GC5483@bicker> <4C08F0DD.50702@bfs.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4C08F0DD.50702@bfs.de> User-Agent: Mutt/1.5.18 (2008-05-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, 04 Jun 2010 15:39:27 +0000 (UTC) diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index ef259a0..cb97e6b 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -1318,8 +1318,11 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file, fragbuf[0] = connection_id; fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00; - if ((status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen)) != 0) + status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen); + if (status) { + status = -EFAULT; goto exit; + } timeout = jiffies + HZ / 2; written = 0; @@ -1494,8 +1497,11 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf, hdr[0] = slot; hdr[1] = connection_id; - if ((status = copy_to_user(buf, hdr, 2)) != 0) + status = copy_to_user(buf, hdr, 2); + if (status) { + status = -EFAULT; goto exit; + } status = pktlen; exit: