master hovercats/oakiss / pkg / iproute2 / patch / 0008-Avoid-unnecessary-VLAs.patch
 1From ab8a58c777d6bc3e33b1f28c80fa5bbada804a4b Mon Sep 17 00:00:00 2001
 2From: Michael Forney <mforney@mforney.org>
 3Date: Sun, 16 Jun 2019 13:38:59 -0700
 4Subject: [PATCH] Avoid unnecessary VLAs
 5
 6---
 7 include/bpf_scm.h | 2 +-
 8 ip/iptuntap.c     | 5 ++---
 9 2 files changed, 3 insertions(+), 4 deletions(-)
10
11diff --git a/include/bpf_scm.h b/include/bpf_scm.h
12index 669f0538..9e456030 100644
13--- a/include/bpf_scm.h
14+++ b/include/bpf_scm.h
15@@ -37,7 +37,7 @@ static inline int *bpf_map_set_init(struct bpf_map_set_msg *msg,
16 				    struct sockaddr_un *addr,
17 				    unsigned int addr_len)
18 {
19-	const unsigned int cmsg_ctl_len = sizeof(int) * BPF_SCM_MAX_FDS;
20+	enum { cmsg_ctl_len = sizeof(int) * BPF_SCM_MAX_FDS };
21 	struct cmsghdr *cmsg;
22 
23 	msg->iov.iov_base = &msg->aux;
24diff --git a/ip/iptuntap.c b/ip/iptuntap.c
25index 3cf55055..e149ae16 100644
26--- a/ip/iptuntap.c
27+++ b/ip/iptuntap.c
28@@ -270,8 +270,7 @@ static void show_processes(const char *name)
29 
30 	fd_path = globbuf.gl_pathv;
31 	while (*fd_path) {
32-		const size_t linkbuf_len = strlen(TUNDEV) + 2;
33-		char linkbuf[linkbuf_len], *fdinfo;
34+		char linkbuf[sizeof(TUNDEV) + 1], *fdinfo;
35 		int pid, fd;
36 		FILE *f;
37 
38@@ -281,7 +280,7 @@ static void show_processes(const char *name)
39 		if (pid == getpid())
40 			goto next;
41 
42-		err = readlink(*fd_path, linkbuf, linkbuf_len - 1);
43+		err = readlink(*fd_path, linkbuf, sizeof(linkbuf) - 1);
44 		if (err < 0) {
45 			perror("readlink");
46 			goto next;
47-- 
482.44.0
49