From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CFD38A04C3; Wed, 13 Nov 2019 19:53:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 747052B8B; Wed, 13 Nov 2019 19:53:46 +0100 (CET) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id 71A3327D for ; Wed, 13 Nov 2019 19:53:45 +0100 (CET) Received: by mail-pg1-f194.google.com with SMTP id q22so1936333pgk.2 for ; Wed, 13 Nov 2019 10:53:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wdU/nQqO550gP0Iz6qpPLVbh9irO817rF930swWJkQQ=; b=lo7EMSsGU+HV2tgnvcmvgHjXBnJIULsTJrW0+rQPol0n9daIwtSUBkasASUig7sv5Y P6XIVegWUFP+RRYzRq5r5gtCYRi9LqwifUEZTavX+TJd/dkLdDfTY7guazkaCzRnE6MX 8orZOe85+otypoko3HfKwz1U3oFuiOg0REawHSR3QC5sMKE+FoaQHVltSfwLBCZzpaoX SJdRg/OQNWDV5h03pnAyiDnNsJPYGV9xQK2NtblaP2b17hMBlUjd/0EoI5CPsMtocgzb 8028IwomuimoM4ncqBLT5wDPAUzVxJTjF7I9TRrs43elbe5ge5waQlmJx2HmDDTmBPe1 id3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wdU/nQqO550gP0Iz6qpPLVbh9irO817rF930swWJkQQ=; b=UTjvFREqnhxXQA7NYf5XC8WCVYL6m6dAUEnOMkn1IPQgWHObaEgxU4VmRD84ZsEaVA RybGML+Gjw2Pf17mWWq6SY5wGd/X7R/5g5s3KDUKXEvjbl3fgbt5RfVgWdS6pP3tRAOv pVHPD8O5a3C+/c7Vyg4yLYJSaRpNw4yKTXh+Tu0bMl7blPqBQkXldQ7eWzOh9qpmpk3b 7xPxrm/dZA42FWRvGq9vjDUszfuy/gYWTtbjysZzqRPGXk4cdjDu+oER7Z+QCcYrAwgF caOYEIvP2HC8NlKUd9He10Qq5rxDL3oPyit0HpyDLNixvQGFpSa310qiwRzhlWjg88WW coLA== X-Gm-Message-State: APjAAAWq9tSzAWkpep8XbK5g+FNVSRwslNrZ9n5yU6Ep4vR77+8eLz4l +fK43k6OKg+C16AVVD+yZmPDew== X-Google-Smtp-Source: APXvYqxDpG1u2ulVBZiNtLjaVliPragSypxQpa+MXDMqgdc/5m39mKdaoUWTtgUCFazYh6lmRMMN4A== X-Received: by 2002:a63:ff65:: with SMTP id s37mr5305559pgk.331.1573671224347; Wed, 13 Nov 2019 10:53:44 -0800 (PST) Received: from shemminger-XPS-13-9360 (67-207-105-98.static.wiline.com. [67.207.105.98]) by smtp.gmail.com with ESMTPSA id l62sm3679812pgl.24.2019.11.13.10.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2019 10:53:44 -0800 (PST) Date: Wed, 13 Nov 2019 10:53:40 -0800 From: Stephen Hemminger To: Matan Azrad Cc: "dev@dpdk.org" , Stephen Hemminger Message-ID: <20191113105340.2928201a@shemminger-XPS-13-9360> In-Reply-To: References: <20190726165054.24078-1-stephen@networkplumber.org> <20190805163817.3713-1-stephen@networkplumber.org> <20190805163817.3713-2-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v7 1/2] examples/multi_process/client_server_mp: check port validity X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, 6 Aug 2019 12:07:25 +0000 Matan Azrad wrote: > Hi > > > > -----Original Message----- > > From: dev On Behalf Of Stephen Hemminger > > Sent: Monday, August 5, 2019 7:38 PM > > To: dev@dpdk.org > > Cc: Stephen Hemminger > > Subject: [dpdk-dev] [PATCH v7 1/2] > > examples/multi_process/client_server_mp: check port validity > > > > From: Stephen Hemminger > > > > The mp_server incorrectly allows a port mask that included hidden ports and > > which later caused either lost packets or failed initialization. > > > > This fixes explicitly checking that each bit in portmask is a valid port before > > using it. > > > > Fixes: 5b7ba31148a8 ("ethdev: add port ownership") > > Signed-off-by: Stephen Hemminger > > --- > > .../client_server_mp/mp_server/args.c | 40 ++++++++++--------- > > .../client_server_mp/mp_server/args.h | 2 +- > > .../client_server_mp/mp_server/init.c | 7 +--- > > 3 files changed, 25 insertions(+), 24 deletions(-) > > > > diff --git a/examples/multi_process/client_server_mp/mp_server/args.c > > b/examples/multi_process/client_server_mp/mp_server/args.c > > index b0d8d7665c85..3c2ca266b096 100644 > > --- a/examples/multi_process/client_server_mp/mp_server/args.c > > +++ b/examples/multi_process/client_server_mp/mp_server/args.c > > @@ -10,6 +10,7 @@ > > #include > > > > #include > > +#include > > #include > > > > #include "common.h" > > @@ -41,31 +42,34 @@ usage(void) > > * array variable > > */ > > static int > > -parse_portmask(uint8_t max_ports, const char *portmask) > > +parse_portmask(const char *portmask) > > { > > char *end = NULL; > > - unsigned long pm; > > - uint16_t count = 0; > > + unsigned long long pm; > > + uint16_t id; > > > > if (portmask == NULL || *portmask == '\0') > > return -1; > > > > /* convert parameter to a number and verify */ > > - pm = strtoul(portmask, &end, 16); > > - if (end == NULL || *end != '\0' || pm == 0) > > + errno = 0; > > + pm = strtoull(portmask, &end, 16); > > + if (errno != 0 || end == NULL || *end != '\0') > > return -1; > > > Please Continue discussion on this on V5 thread. The V5 thread degenerated into "applications should not use portmask". That is a valid discussion but out of scope for this patch which is a bug fix for users.