Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2082850ybg; Fri, 5 Jun 2020 05:18:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlidKvDyO5dk5yttGhrjZEM2QAP8vat0kqaLPJfeVn1UlL7+8uY1h/TnJvfpvpKLxxSFwH X-Received: by 2002:a17:907:119a:: with SMTP id uz26mr8884151ejb.523.1591359485098; Fri, 05 Jun 2020 05:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591359485; cv=none; d=google.com; s=arc-20160816; b=uiCrkF2IYvU54I+8k5Y6j3IBwHB+J9RBHJh7Q+hAqp+COTpx4No1AY0hy+opRlrJW1 EwHM38zM47KFare7dVtBfu3Yx9/gAb7l1KSCAP6qZKIqpVszCcVt3IL28xGftEkWV4uJ nC7hh2ch/60tj4tgNvuvK6PRKcMPq4lLfwAilv+a+LvoUF1o4pCG9D1UO/aUCdAzeXwl S1TPi/ZV510Qyw9vtjVc44YNlYrU1YUFrBinPnYeFKRj9EBob3EcPOHNEzmsPFAGmmYu u3xvdMoi8/g/+WTCkuXgo5zYr7EMyoGLBxDDOhyZOG/zHFo/LhfDOKHINGRARcnIqAgc VrLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=T88+J0sL2lysOkOpeQdmaBaYyaTDFRghSaTW71ivI2A=; b=xVK5JpCwICCMAGMQPXxjqjyC7tNLW4NQ7vUu21NN0yQl+F2Hx9OzxRi+9fo2Vo6LiP lyZNK2Zt9Li1pG2kzhd+g93ofPOtnwOQJPG33I+kPo+9lcgQPzsbSQ9k9CpkNNOhmvEC moBamqcUoHltanBpxZT82gC4ORYFlmghDlniWq8Ospbuq3R2hRtLXSgOUcdaNzdP7PcC ny8s7Nwv2rlc1kqSrF8/Y4vJiYS/pks78pcBPUpIoE6K61dMIzfhl4KeE/aWYBD2g9fq 9J+JS6I9C/at6+dCPlWa0mor9xMp1p+qweIej1xRNB3FwiXcF/W788msToy2fnS3AGM1 +DmA== 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 13si3452402edx.388.2020.06.05.05.17.31; Fri, 05 Jun 2020 05:18:05 -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 S1726415AbgFEMR3 (ORCPT + 99 others); Fri, 5 Jun 2020 08:17:29 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:42236 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgFEMR2 (ORCPT ); Fri, 5 Jun 2020 08:17:28 -0400 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.0.7]) by fornost.hmeau.com with smtp (Exim 4.92 #5 (Debian)) id 1jhBHT-0005Un-DC; Fri, 05 Jun 2020 22:17:04 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 05 Jun 2020 22:17:03 +1000 Date: Fri, 5 Jun 2020 22:17:03 +1000 From: Herbert Xu To: Zhangfei Gao Cc: Greg Kroah-Hartman , Jonathan Cameron , wangzhou1 , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, kbuild-all@lists.01.org Subject: Re: [PATCH] crypto: hisilicon - fix strncpy warning with strlcpy Message-ID: <20200605121703.GA3792@gondor.apana.org.au> References: <202006032110.BEbKqovX%lkp@intel.com> <1591241524-6452-1-git-send-email-zhangfei.gao@linaro.org> <20200604033918.GA2286@gondor.apana.org.au> <20200604061811.GA28759@gondor.apana.org.au> <20200604065009.GA29822@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Jun 05, 2020 at 05:34:32PM +0800, Zhangfei Gao wrote: > Will add a check after the copy. > > ??????? strlcpy(interface.name, pdev->driver->name, sizeof(interface.name)); > ??????? if (strlen(pdev->driver->name) != strlen(interface.name)) > ??????????????? return -EINVAL; You don't need to do strlen. The function strlcpy returns the length of the source string. Better yet use strscpy which will even return an error for you. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt