From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22F80C3A59D for ; Thu, 22 Aug 2019 08:31:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E420B2342E for ; Thu, 22 Aug 2019 08:31:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Dj1kPkhq"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="UbAVT4ht" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E420B2342E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=xL2TDYTR0fG/r1wi7Y9dS2loK1JaSXxLG/j7uA3XOak=; b=Dj1kPkhqNlFKqP YwKHaz3yiPwYvt9a91E85W34rAlltdInS21iF5b6jHuCgD1AyJHyXDInmDIpOS2srkTuxRAQjZsOa xsVoMaYgC9v4pkAiBYUCHNYDJJBvcoNBJQiV3Lgew/RDT2kN40i0JYnS/qUqvHaK5/URWu5v11qnM RYfKm+PHvcXgWqRBDDbL6cKVIjcMUoy+nzMynfeQJ+fRe1b1ICxo9/md9a1KFYZJ9Tl4eLyFEmsHN RfyCS//rOc71LTWCcWYG+rUQYOojKmrL4ozrbY30UAcu0tzwHYsLee+PzOtetE0EJBW/ADzkSEVRS KCtCvSuFeljnlc+oOjDg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i0iV7-0001C7-Fq; Thu, 22 Aug 2019 08:31:21 +0000 Received: from userp2130.oracle.com ([156.151.31.86]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i0iV3-0001Bl-Rf for linux-arm-kernel@lists.infradead.org; Thu, 22 Aug 2019 08:31:19 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7M8T40f083059; Thu, 22 Aug 2019 08:31:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=wvYiP03diDw4mPM79mRFmzdAWF1KTz/Do+tWoBDqL7g=; b=UbAVT4htoWZXk08/Rp3rfixodscqhAqT3egD7NadwHwljZtuKydKUALM9Wwm5bwRV3OV f7CjKlS5Gt9OwxM8+D9cRtHCcNTWdI9deh+zO9GMcvsgfH2mHHf6HXgOxYLVdQaFMGN7 UQFUuVaxHsgpqRYNAqG7ufltA9vjddQQS5cnQ+bcJVRARGgF8SOgkdR1tAZ2x7U7rC3N yEMxn2eMhj6iudYi2fn0L1V0QvA3XDqPjMlJ+p35hpvag18Wnu9LRDLonyUUwocdJk1L 6WcrCeqSJOb+zs5FM+PAXJWtFNpe+SkIr9dg75lE0v8nTPsYfCRPezApjbDdblRfSrAD dA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2ue90tuvhe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Aug 2019 08:31:13 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7M8T8fK020772; Thu, 22 Aug 2019 08:31:13 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2uh83pr6ap-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Aug 2019 08:31:13 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7M8VCtK031210; Thu, 22 Aug 2019 08:31:12 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Aug 2019 01:31:11 -0700 Date: Thu, 22 Aug 2019 11:31:05 +0300 From: Dan Carpenter To: Derek Kiernan , Dragan Cvetic Subject: [PATCH 2/4 v2] misc: xilinx_sdfec: Return -EFAULT if copy_from_user() fails Message-ID: <20190822083105.GI3964@kadam> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190821070702.GB26957@mwanda> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908220093 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908220093 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190822_013118_029565_3ACED6A3 X-CRM114-Status: GOOD ( 17.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Greg Kroah-Hartman , kernel-janitors@vger.kernel.org, Michal Simek , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org The copy_from_user() function returns the number of bytes remaining to be copied but we want to return -EFAULT to the user. Fixes: 20ec628e8007 ("misc: xilinx_sdfec: Add ability to configure LDPC") Signed-off-by: Dan Carpenter Reviewed-by: Michal Simek --- v2: Fix a typo in the commit message. funciton --> function drivers/misc/xilinx_sdfec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c index dc1b8b412712..813b82c59360 100644 --- a/drivers/misc/xilinx_sdfec.c +++ b/drivers/misc/xilinx_sdfec.c @@ -651,9 +651,10 @@ static int xsdfec_add_ldpc(struct xsdfec_dev *xsdfec, void __user *arg) if (!ldpc) return -ENOMEM; - ret = copy_from_user(ldpc, arg, sizeof(*ldpc)); - if (ret) + if (copy_from_user(ldpc, arg, sizeof(*ldpc))) { + ret = -EFAULT; goto err_out; + } if (xsdfec->config.code == XSDFEC_TURBO_CODE) { ret = -EIO; -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel