]> git.baikalelectronics.ru Git - kernel.git/commit
net/sched/sch_htb: clamp xstats tokens to fit into 32-bit int
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Sat, 16 Jul 2016 14:08:56 +0000 (17:08 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Jul 2016 05:44:31 +0000 (22:44 -0700)
commit7687f5392764f9cea1080597d9dee5fa51216ce8
treec5e1ce04411e5a08980e5a5b7411632d893f1607
parent26f19bc6cc5734a66123d7f9906c4563020ab0dc
net/sched/sch_htb: clamp xstats tokens to fit into 32-bit int

In kernel HTB keeps tokens in signed 64-bit in nanoseconds. In netlink
protocol these values are converted into pshed ticks (64ns for now) and
truncated to 32-bit. In struct tc_htb_xstats fields "tokens" and "ctokens"
are declared as unsigned 32-bit but they could be negative thus tool 'tc'
prints them as signed. Big values loose higher bits and/or become negative.

This patch clamps tokens in xstat into range from INT_MIN to INT_MAX.
In this way it's easier to understand what's going on here.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_htb.c