DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wu, Jingjing" <jingjing.wu@intel.com>
To: Yong Wang <wang.yong19@zte.com.cn>,
	"Zhang, Helin" <helin.zhang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix param check to avoid division by 0
Date: Tue, 20 Jun 2017 02:44:46 +0000	[thread overview]
Message-ID: <9BB6961774997848B5B42BEC655768F810DAA643@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1497258420-11814-1-git-send-email-wang.yong19@zte.com.cn>



> -----Original Message-----
> From: Yong Wang [mailto:wang.yong19@zte.com.cn]
> Sent: Monday, June 12, 2017 5:07 PM
> To: Zhang, Helin <helin.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Yong Wang <wang.yong19@zte.com.cn>
> Subject: [PATCH] net/i40e: fix param check to avoid division by 0
> 
> In function i40e_vsi_config_tc_queue_mapping(), if 'enabled_tcmap' is
> 0, 'total_tc' might be 0. Then 'total_tc' might be used in a division
> by 0 in "qpnum_per_tc = i40e_align_floor(vsi->nb_qps / total_tc)". Fix
> it by adding a check to parameter 'enabled_tcmap'.
> 
> Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index c18a93b..d41b213 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -4257,6 +4257,11 @@ enum i40e_status_code
>  	int i, total_tc = 0;
>  	uint16_t qpnum_per_tc, bsf, qp_idx;
> 
> +	if (enabled_tcmap == 0) {
> +		PMD_DRV_LOG(ERR, "Error! enabled tcmap shouldn't be 0");
> +		return I40E_ERR_PARAM;
> +	}
> +
>  	ret = validate_tcmap_parameter(vsi, enabled_tcmap);
>  	if (ret != I40E_SUCCESS)
>  		return ret;
> --
Thanks for the fix.

Could you add the check in func validate_tcmap_parameter?

Thanks
Jingjing

  reply	other threads:[~2017-06-20  2:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12  9:07 Yong Wang
2017-06-20  2:44 ` Wu, Jingjing [this message]
2017-06-20  7:48   ` wang.yong19
2017-06-23 10:02     ` Wu, Jingjing

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=9BB6961774997848B5B42BEC655768F810DAA643@SHSMSX103.ccr.corp.intel.com \
    --to=jingjing.wu@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=wang.yong19@zte.com.cn \
    /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;
as well as URLs for NNTP newsgroup(s).