Skip to content

Commit

Permalink
sch_tbf: use do_div() for 64-bit divide
Browse files Browse the repository at this point in the history
It's doing a 64-bit divide which is not supported
on 32-bit architectures in psched_ns_t2l(). The
correct way to do this is to use do_div().

It's introduced by commit cc106e4
("net: sched: tbf: fix the calculation of max_size")

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yang Yingliang authored and David S. Miller committed Dec 12, 2013
1 parent 9750223 commit d55d282
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/sched/sch_tbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ static u64 psched_ns_t2l(const struct psched_ratecfg *r,

do_div(len, NSEC_PER_SEC);

if (unlikely(r->linklayer == TC_LINKLAYER_ATM))
len = (len / 53) * 48;
if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) {
do_div(len, 53);
len = len * 48;
}

if (len > r->overhead)
len -= r->overhead;
Expand Down

0 comments on commit d55d282

Please sign in to comment.