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 F33D1A3160 for ; Wed, 9 Oct 2019 10:11:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D20421D408; Wed, 9 Oct 2019 10:11:34 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id B84121BF46 for ; Wed, 9 Oct 2019 10:11:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1570608693; 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=+uT1gw/mEw2cFtIK0LuETOU/lfUHezBj6r2TA3/dFH4=; b=QprPCagDkWMkdGoBwkizxCLDjA3CuqMuCn0FGbRXZtFHTGBCAh8JIDRxQxnts2MG1tYq71 mUtw1gcdv9R/NTP9aoe5RyJLqJt4eckDpKkc8DYo3n1qySpwuwEogdk79hswvgSQTbFsu/ 2oZziW9goUMx6UAkgpt2/EgZA2G4uAk= Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-263-OfvAr5dUMyWBbknYVc5B1Q-1; Wed, 09 Oct 2019 04:11:30 -0400 Received: by mail-vs1-f70.google.com with SMTP id z7so139925vsz.3 for ; Wed, 09 Oct 2019 01:11:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eBvtG7ubpX4V1kuofKXTPGxZe+UhdG0jpnbpz6GfsfU=; b=L88q3u+zI7tDBaUecfao9ME13/vGT8K7AKv4OxIZDqM+1Z6Sot1KZTSQEyu58T2SSN djsgTtZqJyHN4xvg2LmwZUQpnfOv5KrnzsVeIytJ6hGbSp36GxHnB1TqrptUN5ZjL6hM dIfufpsnaHaTVdkTYUep4pL3zdY/i4rrdYN8bKTK69unV4N4qkd0TFvyLA0FWCVKDQM/ lQ6pVGwATEhbJ6tsAMZRbzMkLK05xud38qPQODgYAAfTmFqyVndkasOPmoapiseg0YHW 0d0HFo1RoMJpvtX9sLbLvQGWxsgb4hv2G2Vy8X+JhloPU/PNT7SciefB7lIEWxMSAsRz 262w== X-Gm-Message-State: APjAAAUi4OwPNA8MFBPKvXEi7qNpLMySBaS0gIdEvXibN7fJ0zbAlYQs Tq19PKGhk/vKwua2VGM+UK+yrYQkgQbRslld7B73elMNnwWjrTkMLX/U0H6ZLJqpki8fim8FR/w LuiXel1wevK+FtRaPpoY= X-Received: by 2002:ab0:7107:: with SMTP id x7mr374640uan.87.1570608689952; Wed, 09 Oct 2019 01:11:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxw5uWWFZVxzh3jXn5e6OLubmTDNjxFgrSR9w6KCtkLcBIV4tdV/nJsELq6yXKH8QqM1yKL46ruoH5aLqLxZ8k= X-Received: by 2002:ab0:7107:: with SMTP id x7mr374631uan.87.1570608689613; Wed, 09 Oct 2019 01:11:29 -0700 (PDT) MIME-Version: 1.0 References: <20190813153822.29488-1-stephen@networkplumber.org> In-Reply-To: From: David Marchand Date: Wed, 9 Oct 2019 10:11:18 +0200 Message-ID: To: Stephen Hemminger Cc: dev X-MC-Unique: OfvAr5dUMyWBbknYVc5B1Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH] pci: remove unnecessary access() check 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 Mon, Aug 19, 2019 at 11:58 AM David Marchand wrote: > > On Tue, Aug 13, 2019 at 5:38 PM Stephen Hemminger > wrote: > > > > Just open the sysfs file and handle failure, rather than > > using access(). This eliminates Coverity warnings about > > "time of check versus time of use"; although for this sysfs > > file that is not really an issue anyway. > > > > Coverity ID: 347276 Fixed Coverity tag. Added Fixes: + Cc: stable@dpdk.org > > Signed-off-by: Stephen Hemminger > > Title prefix should be "bus/pci: " (check-git-log.sh). Updated commit title. > > > > --- > > drivers/bus/pci/linux/pci.c | 13 +++++++------ > > 1 file changed, 7 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c > > index 43debaa25114..6c444aa7ae3d 100644 > > --- a/drivers/bus/pci/linux/pci.c > > +++ b/drivers/bus/pci/linux/pci.c > > @@ -512,18 +512,19 @@ pci_device_iommu_support_va(const struct rte_pci_= device *dev) > > "%s/" PCI_PRI_FMT "/iommu/intel-iommu/cap", > > rte_pci_get_sysfs_path(), addr->domain, addr->bus, add= r->devid, > > addr->function); > > - if (access(filename, F_OK) =3D=3D -1) { > > - /* We don't have an Intel IOMMU, assume VA supported*/ > > - return true; > > - } > > > > - /* We have an intel IOMMU */ > > fp =3D fopen(filename, "r"); > > if (fp =3D=3D NULL) { > > - RTE_LOG(ERR, EAL, "%s(): can't open %s\n", __func__, fi= lename); > > + /* We don't have an Intel IOMMU, assume VA supported*/ > > Nit: missing a space before closing the comment. > > > + if (errno =3D=3D ENOENT) > > + return true; > > + > > + RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n", > > + __func__, filename, strerror(errno)); > > return false; > > } > > > > + /* We have an intel IOMMU */ s/intel/Intel/ > > if (fscanf(fp, "%" PRIx64, &vtd_cap_reg) !=3D 1) { > > RTE_LOG(ERR, EAL, "%s(): can't read %s\n", __func__, fi= lename); > > fclose(fp); > > -- > > 2.20.1 > > > > Reviewed-by: David Marchand Applied, thanks! -- David Marchand