Message ID | 20200320021638.1916-1-natechancellor@gmail.com |
---|---|
State | New |
Headers | show |
Series | mlxsw: spectrum_cnt: Fix 64-bit division in mlxsw_sp_counter_resources_register | expand |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c index 0268f0a6662a..7974982533b5 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.c @@ -303,7 +303,7 @@ int mlxsw_sp_counter_resources_register(struct mlxsw_core *mlxsw_core) } /* Check config is valid, no bank over subscription */ - if (WARN_ON(total_bank_config > pool_size / bank_size + 1)) + if (WARN_ON(total_bank_config > div64_u64(pool_size, bank_size) + 1)) return -EINVAL; return 0;