Commit cfcadc97 authored by Dmitry Kravkov's avatar Dmitry Kravkov Committed by David S. Miller

bnx2x: add missing parenthesis to prevent u32 overflow

Commit b475d78f lacked two pairs of parenthesis, causing an overflow in the
congestion management.
Signed-off-by: default avatarDmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: default avatarYuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 123edb18
...@@ -409,7 +409,7 @@ static inline void bnx2x_init_min(const struct cmng_init_input *input_data, ...@@ -409,7 +409,7 @@ static inline void bnx2x_init_min(const struct cmng_init_input *input_data,
*/ */
vdata->vnic_min_rate[vnic].vn_credit_delta = vdata->vnic_min_rate[vnic].vn_credit_delta =
(u32)input_data->vnic_min_rate[vnic] * 100 * (u32)input_data->vnic_min_rate[vnic] * 100 *
T_FAIR_COEF / (8 * 100 * vnicWeightSum); (T_FAIR_COEF / (8 * 100 * vnicWeightSum));
if (vdata->vnic_min_rate[vnic].vn_credit_delta < if (vdata->vnic_min_rate[vnic].vn_credit_delta <
pdata->fair_vars.fair_threshold + pdata->fair_vars.fair_threshold +
MIN_ABOVE_THRESH) { MIN_ABOVE_THRESH) {
...@@ -446,7 +446,7 @@ static inline void bnx2x_init_fw_wrr(const struct cmng_init_input *input_data, ...@@ -446,7 +446,7 @@ static inline void bnx2x_init_fw_wrr(const struct cmng_init_input *input_data,
*/ */
ccd[cos] = ccd[cos] =
(u32)input_data->cos_min_rate[cos] * 100 * (u32)input_data->cos_min_rate[cos] * 100 *
T_FAIR_COEF / (8 * 100 * cosWeightSum); (T_FAIR_COEF / (8 * 100 * cosWeightSum));
if (ccd[cos] < pdata->fair_vars.fair_threshold if (ccd[cos] < pdata->fair_vars.fair_threshold
+ MIN_ABOVE_THRESH) { + MIN_ABOVE_THRESH) {
ccd[cos] = ccd[cos] =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment