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=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, 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 7DDB2C4727E for ; Wed, 30 Sep 2020 13:40:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 30533206B7 for ; Wed, 30 Sep 2020 13:40:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HPktBOId"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="E04XESno" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30533206B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cTbU7/XKSswSoNRZzD86XIo+3cx62HMP3bdRUIHIS44=; b=HPktBOId0s7P1wB2i4elHwcc5 hqGt9HK3LbItgiojRuwADI/APxiSO7DeSLS8fW5Ig7vCw+d3yh4SM/jVC0igi9rII6rsbsd4muOcc tnwSArjXQBHUcYrlimyxaIKTr5oBuz4W162ZOkPWdRA+iBNKn5RRDjmx49Xuud/dttiK2xv0qdBH+ rjHFqiW9/FsGgPERhQ1eHdVvpAq4Tg28uNxa5gEFyMuf2QqTro39Ek4gxSr9/KxKxwU3vg8D344u0 mb2Nxo59lv+Yq6jkwCoohvEwQeAZ01dWOR8GaJve092iEnowCEXnJyIsEGnkyzkb3ZzsfkC3I/Kgz rj2GLb0zA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNcJk-0004De-HE; Wed, 30 Sep 2020 13:38:48 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNcJd-0004DJ-5I for linux-arm-kernel@lists.infradead.org; Wed, 30 Sep 2020 13:38:42 +0000 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08UDX4PN138798; Wed, 30 Sep 2020 09:38:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=+Gvon2NFXY2HwR64ot4UTKRGlN2iANmBqeR1OTawFXg=; b=E04XESnoLwc29JtuF0NuJCVS6gSDafNwcG8G7DFrKZd/ESDA5sEYlCi2cvJnzw8dI7Qx sDpiq+Dkd7VTJyYcE2aCbza6e+1oqdUKd2gm+BklZvpolfCmX7y/12c+KkTDcp/XkO61 2ws+Tp0PDiQ2YJDQkNdNyEmjMsN1Zl+rw6cgtHb2ABQqAfSnOzkkyzlpjxQzhAOdrc1U vMMhUsEuNWcn1WQfDSp1X9TDjSvRfkF8n4ufJyW0PKEyj1qejFxIyu058i3+xAgP9OL+ d4cuSwIIZ6zHeRXzZaLa11RcFat4tzhSPGavZUD1K5HoUOPNmI9DKCY3B76EOYy2Lw3w tw== Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 33vry3mj5w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Sep 2020 09:38:34 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08UDWLoR028259; Wed, 30 Sep 2020 13:38:33 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma05wdc.us.ibm.com with ESMTP id 33sw99dnyw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Sep 2020 13:38:33 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08UDcXZs55247218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Sep 2020 13:38:33 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A670B2066; Wed, 30 Sep 2020 13:38:33 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61A11B205F; Wed, 30 Sep 2020 13:38:32 +0000 (GMT) Received: from [9.163.63.54] (unknown [9.163.63.54]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 30 Sep 2020 13:38:32 +0000 (GMT) Subject: Re: [PATCH] soc: aspeed: xdma: Return -EFAULT if copy_from_user() fails To: Dan Carpenter References: <20200930090334.GB621698@mwanda> From: Eddie James Message-ID: <65b1447e-8f37-69f9-4049-25d130a281f8@linux.ibm.com> Date: Wed, 30 Sep 2020 08:38:31 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200930090334.GB621698@mwanda> Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-30_07:2020-09-30, 2020-09-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 impostorscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009300108 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200930_093841_411599_24D7FC48 X-CRM114-Status: GOOD ( 25.22 ) 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: Andrew Jeffery , kernel-janitors@vger.kernel.org, Joel Stanley , linux-aspeed@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 9/30/20 4:03 AM, Dan Carpenter wrote: > The copy_from_user() function returns the number of bytes remaining > which we weren't able to copy. This should return -EFAULT to the > user. Thanks, Reviewed-by: Eddie James > > Fixes: 86609baa4217 ("soc: aspeed: xdma: Add user interface") > Signed-off-by: Dan Carpenter > --- > drivers/soc/aspeed/aspeed-xdma.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/soc/aspeed/aspeed-xdma.c b/drivers/soc/aspeed/aspeed-xdma.c > index 91b51a3de8df..e6b4744bda64 100644 > --- a/drivers/soc/aspeed/aspeed-xdma.c > +++ b/drivers/soc/aspeed/aspeed-xdma.c > @@ -569,9 +569,8 @@ static ssize_t aspeed_xdma_write(struct file *file, const char __user *buf, > if (len != sizeof(op)) > return -EINVAL; > > - rc = copy_from_user(&op, buf, len); > - if (rc) > - return rc; > + if (copy_from_user(&op, buf, len)) > + return -EFAULT; > > if (!op.len || op.len > client->size || > op.direction > ASPEED_XDMA_DIRECTION_UPSTREAM) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel