Rasmus Villemoes 9093464330 leds: trigger: netdev: use memcpy in device_name_store
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' > device_name
# cat device_name
eth12
# printf 'eth3' > device_name
# cat device_name
eth32

I highly doubt anybody is relying on this behaviour, so switch to
simply copying the bytes (we've already checked that size is <
IFNAMSIZ) and unconditionally zero-terminate it; of course, we also
still have to strip a trailing newline.

This is also preparation for future patches.

Fixes: 06f502f57d0d ("leds: trigger: Introduce a NETDEV trigger")
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-03-30 19:09:32 +01:00
2019-03-17 13:25:26 -07:00
2019-03-16 12:36:39 -07:00
2019-03-07 18:32:03 -08:00
2019-03-17 09:10:56 -07:00
2019-03-17 13:25:26 -07:00
2019-03-16 13:47:14 -07:00
2019-03-17 13:25:26 -07:00
2019-03-16 13:05:32 -07:00
2019-03-17 09:10:56 -07:00
2019-03-13 11:10:42 -07:00
2019-03-15 14:05:00 -07:00
2019-03-16 13:47:14 -07:00
2019-02-21 11:41:19 +00:00
2019-03-06 14:18:59 -08:00
2019-03-10 17:48:21 -07:00
2019-03-17 14:22:26 -07:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.
Description
Linux kernel source tree
Readme
Languages
C 97.5%
Assembly 1%
Shell 0.6%
Python 0.3%
Makefile 0.3%