From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id 75C4B377E for ; Thu, 3 Aug 2017 15:58:41 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id 12so6104425wrb.1 for ; Thu, 03 Aug 2017 06:58:41 -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:content-transfer-encoding:in-reply-to :user-agent; bh=Baj6XvVbxJElzudwYPYWHylb2F8Z4sGt5mBeRuvps/s=; b=2DNmEZFkL5hxYzyTUXswLu7gYTS3wIvvePKk9fYszKEwg28PheIBDu36HrYPS63Lz/ 17ox2nw5HHyRYzsiCdPZ8fkg53a4RkRknPHMm0vqYj5DKczhOyirQyGuKY1sOEhT0sAB tuKKqFPLHte8Y+1nA6P72bm1DgDX50yUKvnF7ku2fxw+Igv7PUqelYaVBaDbHBmbcubV TtElANjdgLupXhHvSTykOrbPTXinNsIjwZZ4GnxEOhEJ9F/tpFj9+Ifn/to0RTaJQvhb ZZ8iR0hSq7eQv16eTlEvuZzcJvAO1QYtCaaUqipruQ++30WpfYiTqHtrISRko5tBeIar 9pvQ== 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:content-transfer-encoding :in-reply-to:user-agent; bh=Baj6XvVbxJElzudwYPYWHylb2F8Z4sGt5mBeRuvps/s=; b=Qmm9Aw1NgLCFjxd3Ly7D6qoXgne2Gix1N2kMAdQ9sQKrCt9xhxzOw4sHjJE7SvhInB LOmALflDRyrUrdojtFbqZBD77guc7NBUYNaNNgpItanvI+gxMbPDlzqju+BuW/7DkGj6 NYugS+bL1o5IWRQE1jqPZNa0bbUv4JWlIW4yJHFkrU+qpIz4WFzGFAiJeZz06gQdNluv S3f9tYAzRnJD0xS2ypEG1CT1ZoYWYPCjHRR/2iPPPvCZMBGcFQTuHhSS2os5YesXj9Lc k7cC39VwbVoDgf8vY7Nm//WmYktYqt7unwrJfRRIsNRXqfdcETNyk3z6XAJcqbJTugpY pu0A== X-Gm-Message-State: AIVw112syAg5l6/kQDh6zc1v1EUgd3+wguwB9jVs3ZmLb8Q1/tB+leGa rxVD+S9qPFTV4GB3 X-Received: by 10.223.145.163 with SMTP id 32mr1587404wri.224.1501768720878; Thu, 03 Aug 2017 06:58:40 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id n24sm1707241wrn.59.2017.08.03.06.58.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2017 06:58:40 -0700 (PDT) Date: Thu, 3 Aug 2017 15:58:31 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: rasland@mellanox.com Cc: dev@dpdk.org, thomas@monjalon.net Message-ID: <20170803135831.GG8124@bidouze.vm.6wind.com> References: <1501765798-14200-1-git-send-email-rasland@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1501765798-14200-1-git-send-email-rasland@mellanox.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] net/failsafe: fix for missing pclose after popen 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: , X-List-Received-Date: Thu, 03 Aug 2017 13:58:41 -0000 Hi Raslan, I sent a patch earlier regarding this but we will use yours. Two small nits below. On Thu, Aug 03, 2017 at 04:09:58PM +0300, rasland@mellanox.com wrote: > From: Raslan Darawsheh > > When there is no prefered device, failsafe will always > try to scan for prefered device. And if there is no device > found with the exec option, popen() will get an empty output. > In this case, it was forgotten to close the file descriptor.o > it is fixed by closing the file descriptor even if the output is emtpy. > Good job on finding the issue and fixing it. It has been assigned a coverity ID: Coverity issue: 158633 > Fixes: a0194d82 ("net/failsafe: add flexible device definition") > The fixline should be 12-char long I think: Fixes: a0194d828100 ("net/failsafe: add flexible device definition") > Signed-off-by: Raslan Darawsheh Otherwise: Acked-by: Gaetan Rivet > --- > drivers/net/failsafe/failsafe_args.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c > index 932e371..3f92a77 100644 > --- a/drivers/net/failsafe/failsafe_args.c > +++ b/drivers/net/failsafe/failsafe_args.c > @@ -115,7 +115,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) > char output[DEVARGS_MAXLEN + 1]; > size_t len; > int old_err; > - int ret; > + int ret, pclose_ret; > > RTE_ASSERT(cmdline != NULL || sdev->cmdline != NULL); > if (sdev->cmdline == NULL) { > @@ -145,7 +145,8 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) > /* We only read one line */ > if (fgets(output, sizeof(output) - 1, fp) == NULL) { > DEBUG("Could not read command output"); > - return -ENODEV; > + ret = -ENODEV; > + goto ret_pclose; > } > fs_sanitize_cmdline(output); > ret = fs_parse_device(sdev, output); > @@ -154,12 +155,12 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) > goto ret_pclose; > } > ret_pclose: > - ret = pclose(fp); > - if (ret) { > - ret = errno; > + pclose_ret = pclose(fp); > + if (pclose_ret) { > + pclose_ret = errno; > ERROR("pclose: %s", strerror(errno)); > errno = old_err; > - return ret; > + return pclose_ret; > } > return ret; > } > -- > 2.7.4 > -- Gaëtan Rivet 6WIND