diff mbox

[iproute2,2/2] tc: Use correct variable type for get_distribution() result

Message ID 4ECD6267.3090406@intra2net.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Thomas Jarosch Nov. 23, 2011, 9:15 p.m. UTC
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.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
 tc/q_netem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

stephen hemminger Nov. 23, 2011, 10:48 p.m. UTC | #1
On Wed, 23 Nov 2011 22:15:19 +0100
Thomas Jarosch <thomas.jarosch@intra2net.com> wrote:

> 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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tc/q_netem.c b/tc/q_netem.c
index 01639a8..6dc40bd 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -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;