Force 64-bit arithmetic to be used when converting uint32_t rate and burst parameters from kilobits per second to bytes per second, avoiding incorrect behavior for rates exceeding UINT_MAX bits per second.
Reported-by: "王志克" <wangzh...@jd.com> Fixes: 9509913aa722 ("netdev-dpdk.c: Add ingress-policing functionality.") Signed-off-by: Lance Richardson <lrich...@redhat.com> --- Note: Found by inspection, untested. lib/netdev-dpdk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 1aaf6f7e2..4e8aaa3d8 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -2229,8 +2229,8 @@ netdev_dpdk_policer_construct(uint32_t rate, uint32_t burst) rte_spinlock_init(&policer->policer_lock); /* rte_meter requires bytes so convert kbits rate and burst to bytes. */ - rate_bytes = rate * 1000/8; - burst_bytes = burst * 1000/8; + rate_bytes = rate * 1000ULL / 8; + burst_bytes = burst * 1000ULL / 8; policer->app_srtcm_params.cir = rate_bytes; policer->app_srtcm_params.cbs = burst_bytes; -- 2.13.4 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev