patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Vladimir Medvedkin <vladimir.medvedkin@intel.com>, dev@dpdk.org
Cc: stable@dpdk.org
Subject: Re: [PATCH v3] app/test-fib: fix possible division by zero
Date: Fri, 28 Jan 2022 17:44:05 +0000	[thread overview]
Message-ID: <98830700-195d-f3aa-af56-bdda03303a4a@redhat.com> (raw)
In-Reply-To: <20220127180853.1131512-1-vladimir.medvedkin@intel.com>

On 27/01/2022 18:08, Vladimir Medvedkin wrote:
> This patch fixes the division by 0,
> which occurs if the number of routes is less than 10.
> Can be triggered by passing -n argument with value < 10:
> 
> ./dpdk-test-fib -- -n 9
> ...
> Floating point exception (core dumped)
> 
> Fixes: 103809d032cd ("app/test-fib: add test application for FIB")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> ---

This looks a better solution, and thanks for adding the tags.

Acked-by: Kevin Traynor <ktraynor@redhat.com>

>   app/test-fib/main.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/app/test-fib/main.c b/app/test-fib/main.c
> index ecd420116a..067c5284f9 100644
> --- a/app/test-fib/main.c
> +++ b/app/test-fib/main.c
> @@ -711,6 +711,10 @@ parse_opts(int argc, char **argv)
>   				print_usage();
>   				rte_exit(-EINVAL, "Invalid option -n\n");
>   			}
> +
> +			if (config.nb_routes < config.print_fract)
> +				config.print_fract = config.nb_routes;
> +
>   			break;
>   		case 'd':
>   			distrib_string = optarg;
> @@ -1242,6 +1246,10 @@ main(int argc, char **argv)
>   		config.nb_routes = 0;
>   		while (fgets(line, sizeof(line), fr) != NULL)
>   			config.nb_routes++;
> +
> +		if (config.nb_routes < config.print_fract)
> +			config.print_fract = config.nb_routes;
> +
>   		rewind(fr);
>   	}
>   
> 


  reply	other threads:[~2022-01-28 17:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-23 15:37 [PATCH v2] " Vladimir Medvedkin
2022-01-27 18:08 ` [PATCH v3] " Vladimir Medvedkin
2022-01-28 17:44   ` Kevin Traynor [this message]
2022-02-11  7:55     ` David Marchand

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=98830700-195d-f3aa-af56-bdda03303a4a@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=vladimir.medvedkin@intel.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;
as well as URLs for NNTP newsgroup(s).