[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200610065600.GC6286@sol.localdomain>
Date: Tue, 9 Jun 2020 23:56:00 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: David Laight <David.Laight@...lab.com>
Cc: 'Herbert Xu' <herbert@...dor.apana.org.au>,
Zhangfei Gao <zhangfei.gao@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
wangzhou1 <wangzhou1@...ilicon.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"kbuild-all@...ts.01.org" <kbuild-all@...ts.01.org>
Subject: Re: [PATCH] crypto: hisilicon - fix strncpy warning with strlcpy
On Sun, Jun 07, 2020 at 01:03:45PM +0000, David Laight wrote:
> From: Herbert Xu
> > Sent: 05 June 2020 13:17
> ...
> > Better yet use strscpy which will even return an error for you.
>
> It really ought to return the buffer length on truncation.
> Then you can loop:
> while(...)
> buf += strxxxcpy(buf, src, buf_end - buf);
> and only check right at the end.
>
> David
scnprintf() can be used for that.
But that doesn't seem relevant to this patch.
- Eric
Powered by blists - more mailing lists