Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-27 Thread Andrey Ryabinin
On 10/27/2014 05:42 PM, Sasha Levin wrote: > On 10/26/2014 10:03 PM, David Miller wrote: >> From: Sasha Levin >> Date: Sun, 26 Oct 2014 19:32:42 -0400 >> >>> How so? GCC states clearly that you should *never* pass a NULL >>> pointer there: >>> >>> "The pointers passed to memmove (and similar

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-27 Thread Sasha Levin
On 10/26/2014 10:03 PM, David Miller wrote: > From: Sasha Levin > Date: Sun, 26 Oct 2014 19:32:42 -0400 > >> How so? GCC states clearly that you should *never* pass a NULL >> pointer there: >> >> "The pointers passed to memmove (and similar functions in ) must >> be non-null even when nbytes==0"

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-27 Thread Sasha Levin
On 10/26/2014 10:03 PM, David Miller wrote: From: Sasha Levin sasha.le...@oracle.com Date: Sun, 26 Oct 2014 19:32:42 -0400 How so? GCC states clearly that you should *never* pass a NULL pointer there: The pointers passed to memmove (and similar functions in string.h) must be non-null even

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-27 Thread Andrey Ryabinin
On 10/27/2014 05:42 PM, Sasha Levin wrote: On 10/26/2014 10:03 PM, David Miller wrote: From: Sasha Levin sasha.le...@oracle.com Date: Sun, 26 Oct 2014 19:32:42 -0400 How so? GCC states clearly that you should *never* pass a NULL pointer there: The pointers passed to memmove (and similar

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-26 Thread David Miller
From: Sasha Levin Date: Sun, 26 Oct 2014 19:32:42 -0400 > How so? GCC states clearly that you should *never* pass a NULL > pointer there: > > "The pointers passed to memmove (and similar functions in ) must > be non-null even when nbytes==0" > (https://gcc.gnu.org/gcc-4.9/porting_to.html). >

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-26 Thread Sasha Levin
On 10/22/2014 02:15 AM, David Miller wrote: > From: Sasha Levin > Date: Tue, 21 Oct 2014 22:19:36 -0400 > >> On 10/21/2014 09:39 PM, David Miller wrote: >>> From: Sasha Levin >>> Date: Tue, 21 Oct 2014 16:51:09 -0400 >>> > netlink uses empty data to seperate different levels. However, we

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-26 Thread Sasha Levin
On 10/22/2014 02:15 AM, David Miller wrote: From: Sasha Levin sasha.le...@oracle.com Date: Tue, 21 Oct 2014 22:19:36 -0400 On 10/21/2014 09:39 PM, David Miller wrote: From: Sasha Levin sasha.le...@oracle.com Date: Tue, 21 Oct 2014 16:51:09 -0400 netlink uses empty data to seperate

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-26 Thread David Miller
From: Sasha Levin sasha.le...@oracle.com Date: Sun, 26 Oct 2014 19:32:42 -0400 How so? GCC states clearly that you should *never* pass a NULL pointer there: The pointers passed to memmove (and similar functions in string.h) must be non-null even when nbytes==0

RE: [PATCH] netlink: don't copy over empty attribute data

2014-10-22 Thread David Laight
From: Sasha Levin > netlink uses empty data to seperate different levels. However, we still > try to copy that data from a NULL ptr using memcpy, which is an undefined > behaviour. > > Signed-off-by: Sasha Levin > --- > lib/nlattr.c |3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-22 Thread David Miller
From: Sasha Levin Date: Tue, 21 Oct 2014 22:19:36 -0400 > On 10/21/2014 09:39 PM, David Miller wrote: >> From: Sasha Levin >> Date: Tue, 21 Oct 2014 16:51:09 -0400 >> >>> > netlink uses empty data to seperate different levels. However, we still >>> > try to copy that data from a NULL ptr using

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-22 Thread David Miller
From: Sasha Levin sasha.le...@oracle.com Date: Tue, 21 Oct 2014 22:19:36 -0400 On 10/21/2014 09:39 PM, David Miller wrote: From: Sasha Levin sasha.le...@oracle.com Date: Tue, 21 Oct 2014 16:51:09 -0400 netlink uses empty data to seperate different levels. However, we still try to copy

RE: [PATCH] netlink: don't copy over empty attribute data

2014-10-22 Thread David Laight
From: Sasha Levin netlink uses empty data to seperate different levels. However, we still try to copy that data from a NULL ptr using memcpy, which is an undefined behaviour. Signed-off-by: Sasha Levin sasha.le...@oracle.com --- lib/nlattr.c |3 ++- 1 file changed, 2 insertions(+), 1

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-21 Thread Sasha Levin
On 10/21/2014 09:39 PM, David Miller wrote: > From: Sasha Levin > Date: Tue, 21 Oct 2014 16:51:09 -0400 > >> > netlink uses empty data to seperate different levels. However, we still >> > try to copy that data from a NULL ptr using memcpy, which is an undefined >> > behaviour. >> > >> >

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-21 Thread David Miller
From: Sasha Levin Date: Tue, 21 Oct 2014 16:51:09 -0400 > netlink uses empty data to seperate different levels. However, we still > try to copy that data from a NULL ptr using memcpy, which is an undefined > behaviour. > > Signed-off-by: Sasha Levin This isn't a POSIX C library, this it the

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-21 Thread David Miller
From: Sasha Levin sasha.le...@oracle.com Date: Tue, 21 Oct 2014 16:51:09 -0400 netlink uses empty data to seperate different levels. However, we still try to copy that data from a NULL ptr using memcpy, which is an undefined behaviour. Signed-off-by: Sasha Levin sasha.le...@oracle.com This

Re: [PATCH] netlink: don't copy over empty attribute data

2014-10-21 Thread Sasha Levin
On 10/21/2014 09:39 PM, David Miller wrote: From: Sasha Levin sasha.le...@oracle.com Date: Tue, 21 Oct 2014 16:51:09 -0400 netlink uses empty data to seperate different levels. However, we still try to copy that data from a NULL ptr using memcpy, which is an undefined behaviour.