From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ameen Ali <ameenali023@gmail.com>,
shahed.shaikh@qlogic.com, Dept-GELinuxNICDev@qlogic.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 6/6] qlcnic_dcb.c : possible division by zero.
Date: Thu, 26 Feb 2015 17:22:50 +0300 [thread overview]
Message-ID: <54EF2C3A.3020505@cogentembedded.com> (raw)
In-Reply-To: <1424901403-6458-1-git-send-email-ameenali023@gmail.com>
Hello.
On 02/26/2015 12:56 AM, Ameen Ali wrote:
> 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)
Space needed after *if*. Please run your patches thru
scripts/checkpatch.pl before posting.
> tc_cfg->bwg_percent = (100 / cnt);
What happens to 'tc_cfg->bwg_percent' when cnt == 0?
You need to indent this line by an extra TAB, since it's a part of the
*if* statment now.
> *bw_per = tc_cfg->bwg_percent;
> }
WBR, Sergei
next prev parent reply other threads:[~2015-02-26 14:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 21:56 [PATCH 6/6] qlcnic_dcb.c : possible division by zero Ameen Ali
2015-02-25 22:01 ` David Miller
2015-02-26 14:22 ` Sergei Shtylyov [this message]
-- strict thread matches above, loose matches on Subject: below --
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=54EF2C3A.3020505@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=Dept-GELinuxNICDev@qlogic.com \
--cc=ameenali023@gmail.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