[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200604033918.GA2286@gondor.apana.org.au>
Date: Thu, 4 Jun 2020 13:39:18 +1000
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Zhangfei Gao <zhangfei.gao@...aro.org>
Cc: Greg Kroah-Hartman
<gregkh@...uxfoundation.org>,
Jonathan Cameron
<Jonathan.Cameron@...wei.com>,
wangzhou1 <wangzhou1@...ilicon.com>,
linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org,
kbuild-all@...ts.01.org
Subject: Re: [PATCH] crypto: hisilicon - fix strncpy warning with strlcpy
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 <lkp@...el.com>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@...aro.org>
> ---
> 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 <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists