[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1424901914-6582-1-git-send-email-ameenali023@gmail.com>
Date: Thu, 26 Feb 2015 00:05:14 +0200
From: Ameen Ali <ameenali023@...il.com>
To: shahed.shaikh@...gic.com, Dept-GELinuxNICDev@...gic.com
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Ameen Ali <ameenali023@...il.com>
Subject: [PATCH 6/6] qlcnic_dcb.c : possible division by zero.
Whenever there is a division it is usually worthwhile to
add some belt'n'braces code to ensure that cnt != 0, otherwise
a machine signal can occur.
Signed-off-by : Ameen Ali <Ameenali023@...il.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
index a72bcdd..c1d5e48 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
@@ -822,7 +822,7 @@ qlcnic_dcb_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, u8 *prio,
if (temp->valid && (pg == temp->pgid))
cnt++;
}
-
+ if (cnt != 0)
tc_cfg->bwg_percent = (100 / cnt);
*bw_per = tc_cfg->bwg_percent;
}
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists