lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 26 Feb 2015 17:22:50 +0300
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Ameen Ali <ameenali023@...il.com>, shahed.shaikh@...gic.com,
	Dept-GELinuxNICDev@...gic.com
CC:	linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 6/6] qlcnic_dcb.c : possible division by zero.

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

    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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ