lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230917170825.26165-1-stephen@networkplumber.org>
Date: Sun, 17 Sep 2023 10:08:25 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2] fix set-not-used warnings

Building with clang and warnings enabled finds several
places where variable was set but not used.

Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
 bridge/vni.c  | 3 +--
 ip/iptuntap.c | 3 ---
 tc/m_pedit.c  | 3 +--
 tc/q_tbf.c    | 8 --------
 4 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/bridge/vni.c b/bridge/vni.c
index 5978e55c79fd..e804cb3f40c3 100644
--- a/bridge/vni.c
+++ b/bridge/vni.c
@@ -49,13 +49,12 @@ static int parse_vni_filter(const char *argv, struct nlmsghdr *n, int reqsize,
 	int group_type = AF_UNSPEC;
 	struct rtattr *nlvlist_e;
 	char *v;
-	int i;
 
 	if (group && is_addrtype_inet(group))
 		group_type = (group->family == AF_INET) ?  VXLAN_VNIFILTER_ENTRY_GROUP :
 						     VXLAN_VNIFILTER_ENTRY_GROUP6;
 
-	for (i = 0; vni; i++) {
+	while (vni != NULL) {
 		__u32 vni_start = 0, vni_end = 0;
 
 		v = strchr(vni, '-');
diff --git a/ip/iptuntap.c b/ip/iptuntap.c
index 552599e9fa5c..dbb07580f68e 100644
--- a/ip/iptuntap.c
+++ b/ip/iptuntap.c
@@ -107,8 +107,6 @@ static int tap_del_ioctl(struct ifreq *ifr)
 static int parse_args(int argc, char **argv,
 		      struct ifreq *ifr, uid_t *uid, gid_t *gid)
 {
-	int count = 0;
-
 	memset(ifr, 0, sizeof(*ifr));
 
 	ifr->ifr_flags |= IFF_NO_PI;
@@ -187,7 +185,6 @@ static int parse_args(int argc, char **argv,
 			if (get_ifname(ifr->ifr_name, *argv))
 				invarg("\"name\" not a valid ifname", *argv);
 		}
-		count++;
 		argc--; argv++;
 	}
 
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index afdd020b92bc..32f03415d61c 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -627,7 +627,7 @@ static int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p,
 
 	int argc = *argc_p;
 	char **argv = *argv_p;
-	int ok = 0, iok = 0;
+	int ok = 0;
 	struct rtattr *tail;
 
 	while (argc > 0) {
@@ -689,7 +689,6 @@ static int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p,
 			}
 			argc--;
 			argv++;
-			iok++;
 		}
 	}
 
diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index caea6bebd871..f621756d96e6 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -34,7 +34,6 @@ static void explain1(const char *arg, const char *val)
 static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 			 struct nlmsghdr *n, const char *dev)
 {
-	int ok = 0;
 	struct tc_tbf_qopt opt = {};
 	__u32 rtab[256];
 	__u32 ptab[256];
@@ -60,7 +59,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("limit", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (matches(*argv, "latency") == 0) {
 			NEXT_ARG();
 			if (latency) {
@@ -75,7 +73,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("latency", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (matches(*argv, "burst") == 0 ||
 			strcmp(*argv, "buffer") == 0 ||
 			strcmp(*argv, "maxburst") == 0) {
@@ -90,7 +87,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1(parm_name, *argv);
 				return -1;
 			}
-			ok++;
 		} else if (strcmp(*argv, "mtu") == 0 ||
 			   strcmp(*argv, "minburst") == 0) {
 			const char *parm_name = *argv;
@@ -104,7 +100,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1(parm_name, *argv);
 				return -1;
 			}
-			ok++;
 		} else if (strcmp(*argv, "mpu") == 0) {
 			NEXT_ARG();
 			if (mpu) {
@@ -115,7 +110,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("mpu", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (strcmp(*argv, "rate") == 0) {
 			NEXT_ARG();
 			if (rate64) {
@@ -131,7 +125,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("rate", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (matches(*argv, "peakrate") == 0) {
 			NEXT_ARG();
 			if (prate64) {
@@ -147,7 +140,6 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 				explain1("peakrate", *argv);
 				return -1;
 			}
-			ok++;
 		} else if (matches(*argv, "overhead") == 0) {
 			NEXT_ARG();
 			if (overhead) {
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ