Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-09-27 Thread Julia Lawall
On Thu, 26 Sep 2019, Joe Perches wrote: > On Wed, 2019-09-25 at 14:50 -0700, Andrew Morton wrote: > > On Tue, 23 Jul 2019 06:51:36 -0700 Joe Perches wrote: > > > > > Several uses of strlcpy and strscpy have had defects because the > > > last argument of each function is misused or typoed. > >

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-09-27 Thread Julia Lawall
On Thu, 26 Sep 2019, Joe Perches wrote: > On Wed, 2019-09-25 at 14:50 -0700, Andrew Morton wrote: > > On Tue, 23 Jul 2019 06:51:36 -0700 Joe Perches wrote: > > > > > Several uses of strlcpy and strscpy have had defects because the > > > last argument of each function is misused or typoed. > >

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-09-26 Thread Kees Cook
On Thu, Sep 26, 2019 at 01:34:36AM -0700, Joe Perches wrote: > On Wed, 2019-09-25 at 14:50 -0700, Andrew Morton wrote: > > On Tue, 23 Jul 2019 06:51:36 -0700 Joe Perches wrote: > > > > > Several uses of strlcpy and strscpy have had defects because the > > > last argument of each function is

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-09-26 Thread Stephen Kitt
Le 26/09/2019 09:29, Rasmus Villemoes a écrit : On 26/09/2019 02.01, Stephen Kitt wrote: Le 25/09/2019 23:50, Andrew Morton a écrit : On Tue, 23 Jul 2019 06:51:36 -0700 Joe Perches wrote: Several uses of strlcpy and strscpy have had defects because the last argument of each function is

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-09-26 Thread Rasmus Villemoes
On 26/09/2019 10.25, Stephen Kitt wrote: > Le 26/09/2019 09:29, Rasmus Villemoes a écrit : >> On 26/09/2019 02.01, Stephen Kitt wrote: >>> Le 25/09/2019 23:50, Andrew Morton a écrit : On Tue, 23 Jul 2019 06:51:36 -0700 Joe Perches wrote: >> >> Please don't. At least not for the cases

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-09-26 Thread Joe Perches
On Wed, 2019-09-25 at 14:50 -0700, Andrew Morton wrote: > On Tue, 23 Jul 2019 06:51:36 -0700 Joe Perches wrote: > > > Several uses of strlcpy and strscpy have had defects because the > > last argument of each function is misused or typoed. > > > > Add macro mechanisms to avoid this defect. > >

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-09-26 Thread Rasmus Villemoes
On 26/09/2019 02.01, Stephen Kitt wrote: > Le 25/09/2019 23:50, Andrew Morton a écrit : >> On Tue, 23 Jul 2019 06:51:36 -0700 Joe Perches wrote: >> >>> Several uses of strlcpy and strscpy have had defects because the >>> last argument of each function is misused or typoed. >>> >>> Add macro

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-09-25 Thread Stephen Kitt
Le 25/09/2019 23:50, Andrew Morton a écrit : On Tue, 23 Jul 2019 06:51:36 -0700 Joe Perches wrote: Several uses of strlcpy and strscpy have had defects because the last argument of each function is misused or typoed. Add macro mechanisms to avoid this defect. stracpy (copy a string to a

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-09-25 Thread Andrew Morton
On Tue, 23 Jul 2019 06:51:36 -0700 Joe Perches wrote: > Several uses of strlcpy and strscpy have had defects because the > last argument of each function is misused or typoed. > > Add macro mechanisms to avoid this defect. > > stracpy (copy a string to a string array) must have a string >

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-07-24 Thread Joe Perches
On Wed, 2019-07-24 at 08:53 +0200, Rasmus Villemoes wrote: > BUILD_BUG_ON(!__same_type()) > strscpy(dst, src, ARRAY_SIZE(dst)) Doing this without the temporary is less legible to read the compiler error when someone improperly does: char *foo; char *bar; stracpy(foo,

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-07-24 Thread Rasmus Villemoes
On 23/07/2019 17.39, Joe Perches wrote: > On Tue, 2019-07-23 at 16:37 +0200, Rasmus Villemoes wrote: >> On 23/07/2019 15.51, Joe Perches wrote: >>> >>> These mechanisms verify that the dest argument is an array of >>> char or other compatible types like u8 or s8 or equivalent. >> Sorry, but

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-07-23 Thread Joe Perches
On Tue, 2019-07-23 at 16:37 +0200, Rasmus Villemoes wrote: > On 23/07/2019 15.51, Joe Perches wrote: > > Several uses of strlcpy and strscpy have had defects because the > > last argument of each function is misused or typoed. > > > > Add macro mechanisms to avoid this defect. > > > > stracpy

Re: [PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-07-23 Thread Rasmus Villemoes
On 23/07/2019 15.51, Joe Perches wrote: > Several uses of strlcpy and strscpy have had defects because the > last argument of each function is misused or typoed. > > Add macro mechanisms to avoid this defect. > > stracpy (copy a string to a string array) must have a string > array as the first

[PATCH V2 1/2] string: Add stracpy and stracpy_pad mechanisms

2019-07-23 Thread Joe Perches
Several uses of strlcpy and strscpy have had defects because the last argument of each function is misused or typoed. Add macro mechanisms to avoid this defect. stracpy (copy a string to a string array) must have a string array as the first argument (dest) and uses sizeof(dest) as the count of