Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp961196pxj; Fri, 21 May 2021 03:16:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoqq7XL7PSwSN3iOw5EN+jFQ5Y1FgM4wvMr5wmlDnhAXTjqethe3IymoHXPlg2g69melXn X-Received: by 2002:a02:5409:: with SMTP id t9mr3387231jaa.50.1621592163044; Fri, 21 May 2021 03:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621592163; cv=none; d=google.com; s=arc-20160816; b=S3DIVxkXNIfObqvmhnX42x9PPc7t0zyT5qsvcSHwy/hu2ALPWc0WQV6VhoYIZA+VhS OoNV7kuAQMyFsnVDHBsGKn/JZr25zmfrE4TO7IVu8TxWY2sZLerrD0Xe7iPsMNKh+SRc EaT1E5i192xjkOp4VMwD2jnWyKsgNJ0g+3LGF14C5p7EbIWnCelSoGq0jNDYSvoRLwUh UlWw57SMNzqo8Lnl1y2+4jjuIMZv2a7AfMGSGmSRwH6Zg97bqnN85CH+3+XzsnFZxeyy 9e9BEMe1J0xlloseIjDQTQU0d+BTvtsgCLKsYT3/YS9U5cMjosv/3WwQXPlq9HQ20DSc BnIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=iDDiBtJ4pe5sodWx+O61XoNLXmzMeYtRWE3rerrfRkw=; b=jMeFVkC2KMoFlos/aYYW6T/EP6Oyh3E+WcVUnp7S6CaKvR5vODxAUl075u4N0GKd09 LgoDBBb31HVy8jPqEBD+j1QUIhdgyscbkrGhWG/w4X3zpwW8Armq4grLCdA4fJdj1lfR BJRsWw3xBEJ6fJx2l2tMASexK+j+syOd3oiFZigWB4HIW8D+nxAsWKzG2HyBvZEC/+8a aysyb4nMEyDXSJo3r81SXnVlzoG87s7Vtaw8pwpTJWIlJKYenzohRWeC+nSN4zjYdSel zhUz1RVK9I4PAYvzEqZZLIJybdpYh0LD3GzoWQGSoc4WkxcpMaRgCK04LMWFFWJPx8XJ ZS2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o13si4765182ilt.118.2021.05.21.03.15.48; Fri, 21 May 2021 03:16:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236289AbhEUHsd (ORCPT + 99 others); Fri, 21 May 2021 03:48:33 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:55802 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231636AbhEUHsc (ORCPT ); Fri, 21 May 2021 03:48:32 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.92 #5 (Debian)) id 1ljzs9-0004N0-Am; Fri, 21 May 2021 15:47:05 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1ljzs9-0005pM-7x; Fri, 21 May 2021 15:47:05 +0800 Date: Fri, 21 May 2021 15:47:05 +0800 From: Herbert Xu To: Zou Wei Cc: wangzhou1@hisilicon.com, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next v2] crypto: hisilicon - switch to memdup_user_nul() Message-ID: <20210521074705.7neeycmydjqb6va4@gondor.apana.org.au> References: <1620804439-21392-1-git-send-email-zou_wei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1620804439-21392-1-git-send-email-zou_wei@huawei.com> User-Agent: NeoMutt/20170113 (1.7.2) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, May 12, 2021 at 03:27:19PM +0800, Zou Wei wrote: > diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c > index ce439a0..83a5d30 100644 > --- a/drivers/crypto/hisilicon/qm.c > +++ b/drivers/crypto/hisilicon/qm.c > @@ -1570,17 +1570,10 @@ static ssize_t qm_cmd_write(struct file *filp, const char __user *buffer, > if (count > QM_DBG_WRITE_LEN) > return -ENOSPC; > > - cmd_buf = kzalloc(count + 1, GFP_KERNEL); > - if (!cmd_buf) > + cmd_buf = memdup_user_nul(buffer, count); > + if (IS_ERR(cmd_buf)) > return -ENOMEM; You should return the actual error and not ENOMEM. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt