Re: [PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-14 Thread Pavel Machek
Hi! > >> If userspace doesn't end the input with a newline (which can easily > >> happen if the write happens from a C program that does write(fd, > >> iface, strlen(iface))), we may end up including garbage from a > >> previous, longer value in the device_name. For example > >> > >> # cat

Re: [PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-14 Thread Rasmus Villemoes
On 14/03/2019 11.14, Pavel Machek wrote: > Hi! > >> If userspace doesn't end the input with a newline (which can easily >> happen if the write happens from a C program that does write(fd, >> iface, strlen(iface))), we may end up including garbage from a >> previous, longer value in the

Re: [PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-14 Thread Pavel Machek
Hi! > If userspace doesn't end the input with a newline (which can easily > happen if the write happens from a C program that does write(fd, > iface, strlen(iface))), we may end up including garbage from a > previous, longer value in the device_name. For example > > # cat device_name > > #

Re: [PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-14 Thread Uwe Kleine-König
On Thu, Mar 14, 2019 at 10:57:14AM +0100, Rasmus Villemoes wrote: > On 14/03/2019 10.29, Uwe Kleine-König wrote: > > Hello, > > > > On Wed, Mar 13, 2019 at 09:26:12PM +0100, Rasmus Villemoes wrote: > >> --- a/drivers/leds/trigger/ledtrig-netdev.c > >> +++ b/drivers/leds/trigger/ledtrig-netdev.c >

Re: [PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-14 Thread Rasmus Villemoes
On 14/03/2019 10.29, Uwe Kleine-König wrote: > Hello, > > On Wed, Mar 13, 2019 at 09:26:12PM +0100, Rasmus Villemoes wrote: >> --- a/drivers/leds/trigger/ledtrig-netdev.c >> +++ b/drivers/leds/trigger/ledtrig-netdev.c >> @@ -122,7 +122,8 @@ static ssize_t device_name_store(struct device *dev, >>

Re: [PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-14 Thread Uwe Kleine-König
Hello, On Wed, Mar 13, 2019 at 09:26:12PM +0100, Rasmus Villemoes wrote: > --- a/drivers/leds/trigger/ledtrig-netdev.c > +++ b/drivers/leds/trigger/ledtrig-netdev.c > @@ -122,7 +122,8 @@ static ssize_t device_name_store(struct device *dev, > trigger_data->net_dev = NULL; > } >

[PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-13 Thread Rasmus Villemoes
If userspace doesn't end the input with a newline (which can easily happen if the write happens from a C program that does write(fd, iface, strlen(iface))), we may end up including garbage from a previous, longer value in the device_name. For example # cat device_name # printf 'eth12' >