From patchwork Tue Jun 18 07:05:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 2739621 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 964DBC0AB1 for ; Tue, 18 Jun 2013 07:05:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5EF9E2016E for ; Tue, 18 Jun 2013 07:05:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1427F2012F for ; Tue, 18 Jun 2013 07:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750849Ab3FRHFn (ORCPT ); Tue, 18 Jun 2013 03:05:43 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:25619 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750704Ab3FRHFm (ORCPT ); Tue, 18 Jun 2013 03:05:42 -0400 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r5I75bkY013649 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Jun 2013 07:05:38 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5I75a32016618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Jun 2013 07:05:37 GMT Received: from abhmt112.oracle.com (abhmt112.oracle.com [141.146.116.64]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5I75aTr006133; Tue, 18 Jun 2013 07:05:36 GMT Received: from elgon.mountain (/197.237.137.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Jun 2013 00:05:35 -0700 Date: Tue, 18 Jun 2013 10:05:29 +0300 From: Dan Carpenter To: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] fbmem: return -EFAULT on copy_to_user() failure Message-ID: <20130618070529.GA12329@elgon.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP copy_to_user() returns the number of bytes remaining to be copied. put_user() returns -EFAULT on error. This function ORs a bunch of stuff together and returns jumbled non-zero values on error. It should return -EFAULT. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 098bfc6..9217be3 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1305,7 +1305,9 @@ static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix, err |= copy_to_user(fix32->reserved, fix->reserved, sizeof(fix->reserved)); - return err; + if (err) + return -EFAULT; + return 0; } static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,