From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 98E42A0350; Fri, 28 Jan 2022 18:44:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F20794283E; Fri, 28 Jan 2022 18:44:11 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 5B3184278D for ; Fri, 28 Jan 2022 18:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643391849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ll6Z3F7/EQ8eoadJYJv/DiFgahxchQ3U4PgRy7looRo=; b=Eri4P/X+6NbBUqPNQsCcFZ9hDph3WZgqMfYXBT7wmhjiOIGGB53DZtICNgzWSo/JV1TeZU zXBdXunqA0h3pHXYp96qhsUGv/Ttg7TjeX4HdD9IZOUVSFu8NHPEy3ieVXeULD7uc2JWs4 a1tZNrxPcbRpjTff1j2qmowoguYAFcI= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-90-nnr2C6LIPu6WpPE9urbifg-1; Fri, 28 Jan 2022 12:44:08 -0500 X-MC-Unique: nnr2C6LIPu6WpPE9urbifg-1 Received: by mail-wr1-f69.google.com with SMTP id k7-20020adfb347000000b001dd761d46c7so806008wrd.4 for ; Fri, 28 Jan 2022 09:44:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:subject:in-reply-to :content-transfer-encoding; bh=Ll6Z3F7/EQ8eoadJYJv/DiFgahxchQ3U4PgRy7looRo=; b=5j+lyteGfjGpxM//wgYNdfh6jAnUQRnZplxVHNo6fqaAUxJLLaX+BJUu+Xzj0+x7Wp yI20+hrbDAt6SEGtV23yQIXtI6YHT1aFko1LRnekg3SYiCGHO+Oo+YWlGEnjPKoy1BbB 07ujZOPi5ed2WVo/VXyKKpH5e7AgHqLgfHJQUU53LjG/lLz4jHbsRp5d8MScCgnMZVza oKYax09oCzjFjQvOD/LPKmW9sI1MzEuS2XzgoWZ3l9gXxGltBEaAonaMw5xSWFSRZqzV qYLMk5V4xX65f0ouyJX0Rri5Caom/jri17tLF6gSnGcIb3ib9PH2WZmv8CIfetkgdIN9 9AWw== X-Gm-Message-State: AOAM531KW/UnRe78P0ETnYqnQgaAngiMVrU2d57qBcnNcwXr0zZmpLLy kunEiW6ZnGKh3TztOoq59LR1PAIVn0L+6JqyzkkYe1VGR6AJiVdZmG1pRXkIUAikl28cP+TPlWf tAhE= X-Received: by 2002:a1c:f203:: with SMTP id s3mr2865170wmc.112.1643391847266; Fri, 28 Jan 2022 09:44:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzAhvpVzNXabgWkaRoc+v/vOReDHd5R6HY/yaeI99n6u1s7pRTyql3d26CReT48FpaN5cXdw== X-Received: by 2002:a1c:f203:: with SMTP id s3mr2865157wmc.112.1643391846907; Fri, 28 Jan 2022 09:44:06 -0800 (PST) Received: from [192.168.0.36] ([78.19.108.41]) by smtp.gmail.com with ESMTPSA id p7sm5788625wrr.7.2022.01.28.09.44.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Jan 2022 09:44:06 -0800 (PST) Message-ID: <98830700-195d-f3aa-af56-bdda03303a4a@redhat.com> Date: Fri, 28 Jan 2022 17:44:05 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 To: Vladimir Medvedkin , dev@dpdk.org Cc: stable@dpdk.org References: <20211223153742.760838-1-vladimir.medvedkin@intel.com> <20220127180853.1131512-1-vladimir.medvedkin@intel.com> From: Kevin Traynor Subject: Re: [PATCH v3] app/test-fib: fix possible division by zero In-Reply-To: <20220127180853.1131512-1-vladimir.medvedkin@intel.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 > --- This looks a better solution, and thanks for adding the tags. Acked-by: Kevin Traynor > 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); > } > >