RE: [PATCH] net/sched/sch_tbf.c: fix linking error

From: Qais Yousef
Date: Mon Dec 16 2013 - 08:35:14 EST


Sorry for the noise. I'm not sure how this got sent out again. I definitely didn't type any git send-email commands at all today :-/

Qais

> -----Original Message-----
> From: Qais Yousef [mailto:qais.yousef@xxxxxxxxxx]
> Sent: 12 December 2013 12:29
> To: Yang Yingliang
> Cc: Qais Yousef; Eric Dumazet; Jamal Hadi Salim; David S. Miller;
> netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> next@xxxxxxxxxxxxxxx
> Subject: [PATCH] net/sched/sch_tbf.c: fix linking error
>
> ERROR: "__udivdi3" [net/sched/sch_tbf.ko] undefined!
>
> introduced by: cc106e441a63 (net: sched: tbf: fix the calculation of max_size)
>
> which adds a 64 by 32 bit division without using do_div().
> Fix it by using do_div(len/ 53) instead of len/53.
>
> Signed-off-by: Qais Yousef <qais.yousef@xxxxxxxxxx>
> Cc: Eric Dumazet <edumazet@xxxxxxxxxx>
> Cc: Jamal Hadi Salim <jhs@xxxxxxxxxxxx>
> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
> Cc: netdev@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: linux-next@xxxxxxxxxxxxxxx
> ---
> We caught this error on linux-next today. This is my quick attemp of a fix.
> If it's not appropriate or doesn't make sense my apologies and feel free to resend
> a better fix :)
>
> net/sched/sch_tbf.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index a44928c..771cbec
> 100644
> --- a/net/sched/sch_tbf.c
> +++ b/net/sched/sch_tbf.c
> @@ -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 *= 48;
> + }
>
> if (len > r->overhead)
> len -= r->overhead;
> --
> 1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/