From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <adrien.mazarguil@6wind.com>
Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com
 [209.85.128.172]) by dpdk.org (Postfix) with ESMTP id 210C82BF3
 for <dev@dpdk.org>; Thu, 16 Mar 2017 12:04:18 +0100 (CET)
Received: by mail-wr0-f172.google.com with SMTP id u108so29248473wrb.3
 for <dev@dpdk.org>; Thu, 16 Mar 2017 04:04:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-disposition:in-reply-to;
 bh=ZLXOhrFcCOBg5SpMZBZV83iDdDciqOh/oQ4Z2u1gwCk=;
 b=se79bnd49I4HsyDE9VGyPlHbBXSq5VcsG0AGUgmlz0V9QhfEjCgXoJXdx5q9oe9kC6
 S290xayhT33QzMIb2p9NsAypjLicVS1v0hAMGbz3+mQrFHN136HKngUzyaHA6TflrhxX
 uNLf9ob9MJ90vV7typecDGNfUYu40+M8EQ+oh1rDZDkA9sXeeh9nvfZxHrEWY+H7+pY9
 NBwlzmu8rOBrKsDxQZU+sNelt0cbnAua9QmKT6Zy3Z5Y+z8XIDt2Xak8Tliguj55zJbF
 BgCCLkW3IbW3JqYAvW+XHrFGAYrCI8xr5Cqc373w9ccFPIPHWov1Q4rNCMuV2YaZVAol
 Kqdg==
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:references
 :mime-version:content-disposition:in-reply-to;
 bh=ZLXOhrFcCOBg5SpMZBZV83iDdDciqOh/oQ4Z2u1gwCk=;
 b=ICG2B/ji7Db3BXIVvKFqwPAbmzGpSDP2y9hfdvHeMsMK98MBPyH+qgP+voGx9xBB9g
 LIrOdifrw2TLsvgMklImON7Fw9cnBMdraokKtnPxwEpZiqFytYiuq13EOxxsn2ZAmuJ5
 2tDpfkCEbRl89YuoszRYcMjvLGujxp8Yv8ZF+RZzMjdpCRy+ybgp+mCDv7kWhR3Ow+82
 1tBv0BMzCVNA4rL5zEu9RsjLBqPu7gGGQDTlIJH9Ptgpgyvve4dk+8YXCZpYAUNa5xwo
 4uQsVJ6LdTssOAr4vPoRSJFAhSj6XAx+NFThPfpXtTbQSa0Ug8GE0BfiTQxPgh/M62gj
 /oAA==
X-Gm-Message-State: AFeK/H2r3BvOHQZk/gYZ/eKeZLjzuyL+pmui8WBRxmTSejfraQ2Xz7vFKXGC2tGEho69GQoY
X-Received: by 10.223.139.152 with SMTP id o24mr7488003wra.61.1489662257854;
 Thu, 16 Mar 2017 04:04:17 -0700 (PDT)
Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78])
 by smtp.gmail.com with ESMTPSA id x133sm3874892wme.22.2017.03.16.04.04.16
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 16 Mar 2017 04:04:16 -0700 (PDT)
Date: Thu, 16 Mar 2017 12:04:09 +0100
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Gaetan Rivet <gaetan.rivet@6wind.com>
Cc: dev@dpdk.org, Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,
 "Legacy, Allain" <Allain.Legacy@windriver.com>,
 Stephen Hemminger <stephen@networkplumber.org>
Message-ID: <20170316110409.GO3790@6wind.com>
References: <f49bbc965816575b851b22ba3cbcd657a847d9b2.1488550887.git.gaetan.rivet@6wind.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <f49bbc965816575b851b22ba3cbcd657a847d9b2.1488550887.git.gaetan.rivet@6wind.com>
Subject: Re: [dpdk-dev] [PATCH 1/1] net/mlx4: add port parameter
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 16 Mar 2017 11:04:18 -0000

On Fri, Mar 03, 2017 at 04:40:06PM +0100, Gaetan Rivet wrote:
> Most ConnectX-3 adapters expose two physical ports on a single PCI bus
> address.
> 
> Add a new port parameter allowing the user to choose
> either or both physical ports to be used by the application.
> 
> This parameter is used as follows:
> 
> Selecting only the second port:
>    -w 00:00.0,port=1
> 
> Selecting both ports:
>    -w 00:00.0,port=0,port=1
> 
> If no parameter is given, the default behavior is unchanged: all ports
> are probed.
> 
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>

I think this patch is good as is. Whatever value results from users
specifying random characters as argument to the port parameter is their
problem, as long as the resulting value is verified to be within bounds,
it's fine.

I'm not saying that checking all possible failure modes of strtoul() is
useless, just that it seems overkill in this specific case. Using atoi()
without any error checking would have been perfectly fine as well.

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

-- 
Adrien Mazarguil
6WIND