Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp992890ybg; Wed, 3 Jun 2020 20:40:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgwZnsn67vtQ806s2PuIMK1gSixP67gdDkPk4sX16NTbWv0O2WZy3h3aWKz8+yULTv2HsF X-Received: by 2002:aa7:c790:: with SMTP id n16mr2577159eds.54.1591242024440; Wed, 03 Jun 2020 20:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591242024; cv=none; d=google.com; s=arc-20160816; b=A9E2rcKLrtFSCHWNEPzsC74MUMg/yPV6MNIbkwE9tNx9rKqXSRJdWeDHwB0HlFAu95 CzuT8ndD44xVKIUSx2VM1PoJJMP/Pd7BFlRC066rpd/IDWa+eT4LPT1htIgZM8nn6BnO 0OMmeE5zgv36i7rpIixiTwySDhMBfi7EVpcNWB9Ouowyxf9I7/KJk1kc1wT6fQPtVune yJcsS598vyFtJkxJJyTTGGYP9Usfvchet8YHWXyN8oCZAkmKSyjQa2+tl/ZARqfB8iAP myzCkHcbj7kYszvSVF0YFUdljghcqI6iCwLT3JD1evgJnFADRJl+TBbQS7i+7h2gW4QD Dpfg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NxpFw3of5HSLclf5gTY27mbBono+DwRT3VCovsJuz7c=; b=RrTCl564BFQ4gW4ybdhSUx+m6oeeEo22XQXi9hxd5V6D5ypDjo4WN02FvsGBduxtGS jyCdQ1F9e2tWds04N846sy4qE5Y4nYHeSij8TiShMT66HjX1WrL7hhMYy8IHBpYo4tdh d7aUdDZKj7pO0xsUp3teBhrLBh45XrqQRGoD+xK0jvdS6NGcEvD4hbvw0dRyyiWRuW4r c8UO2f5n0alU2xOFT65Emc9Oxmv3YayNr/SWy7OTW7TjZAm/NZmkAMAzzsPBHQqYwW92 KBEEBlIT7JPDeFN+Ta4kuuicasfs36OkM/Mh4D2iier77+jWisDqqEaJZWBjxy5yJihH Ru7A== 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 ox6si883305ejb.678.2020.06.03.20.39.59; Wed, 03 Jun 2020 20:40:24 -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 S1726727AbgFDDjj (ORCPT + 99 others); Wed, 3 Jun 2020 23:39:39 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:35698 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbgFDDjj (ORCPT ); Wed, 3 Jun 2020 23:39:39 -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 1jggis-0000jQ-Bm; Thu, 04 Jun 2020 13:39:19 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Thu, 04 Jun 2020 13:39:18 +1000 Date: Thu, 4 Jun 2020 13:39:18 +1000 From: Herbert Xu To: Zhangfei Gao Cc: =?iso-8859-1?Q?=A0Greg_Kroah-Hartman=A0?= , =?iso-8859-1?Q?=A0Jonathan_Cameron=A0?= , =?iso-8859-1?Q?=A0wangzhou1=A0?= , 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: <20200604033918.GA2286@gondor.apana.org.au> References: <202006032110.BEbKqovX%lkp@intel.com> <1591241524-6452-1-git-send-email-zhangfei.gao@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1591241524-6452-1-git-send-email-zhangfei.gao@linaro.org> 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 Thu, Jun 04, 2020 at 11:32:04AM +0800, Zhangfei Gao wrote: > Use strlcpy to fix the warning > warning: 'strncpy' specified bound 64 equals destination size > [-Wstringop-truncation] > > Reported-by: kernel test robot > Signed-off-by: Zhangfei Gao > --- > drivers/crypto/hisilicon/qm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c > index f795fb5..224f3e2 100644 > --- a/drivers/crypto/hisilicon/qm.c > +++ b/drivers/crypto/hisilicon/qm.c > @@ -1574,7 +1574,7 @@ static int qm_alloc_uacce(struct hisi_qm *qm) > .ops = &uacce_qm_ops, > }; > > - strncpy(interface.name, pdev->driver->name, sizeof(interface.name)); > + strlcpy(interface.name, pdev->driver->name, sizeof(interface.name)); Should this even allow truncation? Perhaps it'd be better to fail in case of an overrun? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt