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: <318e07e5b1d43e31f9664ff0b3628d4f2994aea9.1549536471.git.dcaratti@redhat.com>
Date:   Thu,  7 Feb 2019 11:51:27 +0100
From:   Davide Caratti <dcaratti@...hat.com>
To:     Stephen Hemminger <stephen@...workplumber.org>,
        David Ahern <dsahern@...il.com>
Cc:     Andrea Claudi <aclaudi@...hat.com>, netdev@...r.kernel.org
Subject: [PATCH iproute2-next] use print_{,h}hu instead of print_uint when format specifier is %{,h}hu

in this way, a useless cast to unsigned int is avoided in bpf_print_ops()
and print_tunnel().

Tested with:
 # ./tdc.py -c bpf

Suggested-by: Stephen Hemminger <stephen@...workplumber.org>
Cc: Andrea Claudi <aclaudi@...hat.com>
Signed-off-by: Davide Caratti <dcaratti@...hat.com>
---
 ip/ipl2tp.c | 4 ++--
 lib/bpf.c   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index f699b258a3f0..77bc3249c7ec 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -237,9 +237,9 @@ static void print_tunnel(const struct l2tp_data *data)
 		print_string(PRINT_FP, NULL,
 			     "  UDP source / dest ports:", NULL);
 
-		print_uint(PRINT_ANY, "local_port", " %hu",
+		print_hu(PRINT_ANY, "local_port", " %hu",
 			   p->local_udp_port);
-		print_uint(PRINT_ANY, "peer_port", "/%hu",
+		print_hu(PRINT_ANY, "peer_port", "/%hu",
 			   p->peer_udp_port);
 		print_nl();
 
diff --git a/lib/bpf.c b/lib/bpf.c
index dfc4f4f522c3..c7b3ee1e9618 100644
--- a/lib/bpf.c
+++ b/lib/bpf.c
@@ -353,9 +353,9 @@ void bpf_print_ops(struct rtattr *bpf_ops, __u16 len)
 
 	for (i = 0; i < len; i++) {
 		open_json_object(NULL);
-		print_uint(PRINT_ANY, "code", "%hu ", ops[i].code);
-		print_uint(PRINT_ANY, "jt", "%hhu ", ops[i].jt);
-		print_uint(PRINT_ANY, "jf", "%hhu ", ops[i].jf);
+		print_hu(PRINT_ANY, "code", "%hu ", ops[i].code);
+		print_hhu(PRINT_ANY, "jt", "%hhu ", ops[i].jt);
+		print_hhu(PRINT_ANY, "jf", "%hhu ", ops[i].jf);
 		if (i == len - 1)
 			print_uint(PRINT_ANY, "k", "%u\'", ops[i].k);
 		else
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ