Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932363AbbBZOW6 (ORCPT ); Thu, 26 Feb 2015 09:22:58 -0500 Received: from mail-la0-f44.google.com ([209.85.215.44]:37193 "EHLO mail-la0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932304AbbBZOWy (ORCPT ); Thu, 26 Feb 2015 09:22:54 -0500 Message-ID: <54EF2C3A.3020505@cogentembedded.com> Date: Thu, 26 Feb 2015 17:22:50 +0300 From: Sergei Shtylyov Organization: Cogent Embedded User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Ameen Ali , 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. References: <1424901403-6458-1-git-send-email-ameenali023@gmail.com> In-Reply-To: <1424901403-6458-1-git-send-email-ameenali023@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1406 Lines: 43 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 > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/