Re: [PATCH v2] exec: avoid gcc-8 warning for get_task_comm

2017-12-06 Thread Andrew Morton
On Wed, 6 Dec 2017 15:09:20 -0800 Kees Cook wrote: > >> to do both. > >> > >> Suggested-by: Kees Cook > >> Signed-off-by: Arnd Bergmann > > > > Looks useful. > > > > Acked-by: Ingo Molnar > > Ingo, can you take this into -tip, or should this go via -mm or some other > tree? I have it queued

Re: [PATCH v2] exec: avoid gcc-8 warning for get_task_comm

2017-12-06 Thread Kees Cook
On Wed, Dec 6, 2017 at 9:49 AM, Ingo Molnar wrote: > > * Arnd Bergmann wrote: > >> gcc-8 warns about using strncpy() with the source size as the limit: >> >> fs/exec.c:1223:32: error: argument to 'sizeof' in 'strncpy' call is the same >> expression as the source; did you mean to use the size of

Re: [PATCH v2] exec: avoid gcc-8 warning for get_task_comm

2017-12-06 Thread Ingo Molnar
* Arnd Bergmann wrote: > gcc-8 warns about using strncpy() with the source size as the limit: > > fs/exec.c:1223:32: error: argument to 'sizeof' in 'strncpy' call is the same > expression as the source; did you mean to use the size of the destination? > [-Werror=sizeof-pointer-memaccess] > >

RE: [PATCH v2] exec: avoid gcc-8 warning for get_task_comm

2017-12-06 Thread David Laight
From: Arnd Bergmann > Sent: 05 December 2017 15:17 > gcc-8 warns about using strncpy() with the source size as the limit: Hmmm... Someone 'fixed' some of those in the NetBSD tree a few years back. There was one place where the code was correct. A potentially unterminated string was being copied in

Re: [PATCH v2] exec: avoid gcc-8 warning for get_task_comm

2017-12-05 Thread Kees Cook
On Tue, Dec 5, 2017 at 7:17 AM, Arnd Bergmann wrote: > gcc-8 warns about using strncpy() with the source size as the limit: > > fs/exec.c:1223:32: error: argument to 'sizeof' in 'strncpy' call is the same > expression as the source; did you mean to use the size of the destination? > [-Werror=siz

[PATCH v2] exec: avoid gcc-8 warning for get_task_comm

2017-12-05 Thread Arnd Bergmann
gcc-8 warns about using strncpy() with the source size as the limit: fs/exec.c:1223:32: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess] This is indeed slightly suspicious, as