sandbox fixes
cover sandbox fixes
Antony Pavlov (3):
sandbox: prevent segfault in tap_alloc()
sandbox: eliminale no previous prototype for ‘sandbox_add_device’ warning
sandbox: drop blank lines at EOF
arch/sandbox/board/board.c | 1 - arch/sandbox/board/console.c | 1 - arch/sandbox/board/devices.c | 1 + arch/sandbox/mach-sandbox/include/mach/linux.h | 2 +- arch/sandbox/os/tap.c | 3 +-- 5 files changed, 3 insertions(+), 5 deletions(-)
Signature · 7 lines
2.20.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/3 sandbox: prevent segfault in tap_alloc()
Tap network interface initialization in sandbox barebox leads to segfault under Debian Buster/Sid.
The problem is that strcpy(dev, ifr.ifr_name) inside tap_alloc() tries to alter read-only data passed by tap_probe() and barebox receives SIGSEGV.
Nobody uses network interface name returned by tap_alloc() so we can drop this strcpy().
--- arch/sandbox/mach-sandbox/include/mach/linux.h | 2 +- arch/sandbox/os/tap.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
arch/sandbox/mach-sandbox/include/mach/linux.h +1 -1
@@ -8,7 +8,7 @@ int sandbox_add_device(struct device_d *dev);struct fb_bitfield ;int linux_register_device (const char *name,void *start,void *end); -int tap_alloc (char *dev); +int tap_alloc (const char *dev);uint64_t linux_get_time (void );int linux_read (int fd,void *buf,size_t count);int linux_read_nonblock (int fd,void *buf,size_t count);
arch/sandbox/os/tap.c +1 -2
@@ -28,7 +28,7 @@#include <linux/if_tun.h> #include <string.h> -int tap_alloc (char *dev) +int tap_alloc (const char *dev) {struct ifreq ifr;int fd, err;
@@ -55,7 +55,6 @@ int tap_alloc(char *dev)return err; } -strcpy (dev, ifr.ifr_name);return fd; }
Signature · 7 lines
2.20.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/3 sandbox: eliminale no previous prototype for ‘sandbox_add_device’ warning
In reply to Antony PavlovThe patch fixes the following gcc-8.3.0 warning:
arch/sandbox/board/devices.c:13:5: warning: no previous prototype for ‘sandbox_add_device’ [-Wmissing-prototypes]
int sandbox_add_device(struct device_d *dev)
^~~~~~~~~~~~~~~~~~
--- arch/sandbox/board/devices.c | 1 + 1 file changed, 1 insertion(+)
arch/sandbox/board/devices.c +1 -0
@@ -6,6 +6,7 @@#include <common.h> #include <driver.h> +#include <mach/linux.h> #include <init.h> static LIST_HEAD (sandbox_device_list);
Signature · 7 lines
2.20.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/3 sandbox: drop blank lines at EOF
In reply to Antony Pavlov--- arch/sandbox/board/board.c | 1 - arch/sandbox/board/console.c | 1 - 2 files changed, 2 deletions(-)
arch/sandbox/board/board.c +0 -1
@@ -58,4 +58,3 @@ static int devices_init(void) }device_initcall (devices_init); -
arch/sandbox/board/console.c +0 -1
@@ -40,4 +40,3 @@ int barebox_register_console(int stdinfd, int stdoutfd)return sandbox_add_device (dev); } -
Signature · 7 lines
2.20.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 5 lines · Antony Pavlov
Antony Pavlov (3):
sandbox: prevent segfault intap_alloc()
sandbox: eliminale no previous prototype for ‘sandbox_add_device’ warning
sandbox: drop blank lines at EOF
Applied, thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox