mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ameen Ali <ameenali023@gmail.com>
To: shahed.shaikh@qlogic.com, Dept-GELinuxNICDev@qlogic.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Ameen Ali <ameenali023@gmail.com>
Subject: [PATCH 6/6] qlcnic_dcb.c : possible division by zero.
Date: Wed, 25 Feb 2015 23:56:43 +0200	[thread overview]
Message-ID: <1424901403-6458-1-git-send-email-ameenali023@gmail.com> (raw)

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@gmail.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


             reply	other threads:[~2015-02-25 21:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 21:56 Ameen Ali [this message]
2015-02-25 22:01 ` David Miller
2015-02-26 14:22 ` Sergei Shtylyov
2015-02-25 22:05 Ameen Ali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424901403-6458-1-git-send-email-ameenali023@gmail.com \
    --to=ameenali023@gmail.com \
    --cc=Dept-GELinuxNICDev@qlogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shahed.shaikh@qlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome