Skip to contentSkip to conversation

tc: Use correct variable type for get_distribution() result

PATCH In review Thomas Jarosch 2 participants 2 messages Nov 23, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 tc: Use correct variable type for get_distribution() result

get_distribution() returns an int.

cppcheck reported:
[tc/q_netem.c:243]: (style) Checking if unsigned variable 'dist_size' is less than zero.

The mismatch actually rendered the error checking
after get_distribution() ineffective.

---
 tc/q_netem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tc/q_netem.c +1 -1
index 01639a8..6dc40bd 100644
@@ -125,7 +125,7 @@ static int get_ticks(__u32 *ticks, const char *str)
 static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 			   struct nlmsghdr *n)
 {
-	size_t dist_size = 0;
+	int dist_size = 0;
 	struct rtattr *tail;
 	struct tc_netem_qopt opt;
 	struct tc_netem_corr cor;
Signature · 1 line
1.7.6.4
#1 lore raw
Quoted 5 lines · On Wed, 23 Nov 2011 22:15:19 +0100 Thomas Jarosch…

get_distribution() returns an int.

cppcheck reported:
[tc/q_netem.c:243]: (style) Checking if unsigned variable 'dist_size' is less than zero.

Both applied, thanks.