From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 61B855598 for ; Wed, 16 Nov 2016 12:04:26 +0100 (CET) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP; 16 Nov 2016 03:04:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,647,1473145200"; d="scan'208";a="32000975" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.57]) ([10.237.220.57]) by fmsmga006.fm.intel.com with ESMTP; 16 Nov 2016 03:04:24 -0800 To: "Lu, Wenzhuo" , "Dai, Wei" , "dev@dpdk.org" , "Burakov, Anatoly" , "david.marchand@6wind.com" References: <1479262339-63608-1-git-send-email-zhiyong.yang@intel.com> <1479264047-67966-1-git-send-email-wei.dai@intel.com> <6A0DE07E22DDAD4C9103DF62FEBC09093935007B@shsmsx102.ccr.corp.intel.com> From: Ferruh Yigit Message-ID: <213865d3-d1fa-3caa-92de-3970637b653d@intel.com> Date: Wed, 16 Nov 2016 11:04:23 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <6A0DE07E22DDAD4C9103DF62FEBC09093935007B@shsmsx102.ccr.corp.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v2] eal/linuxapp: fix return value check of mknod() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2016 11:04:26 -0000 Hi Wenzhuo, On 11/16/2016 3:28 AM, Lu, Wenzhuo wrote: > Hi Wei, > >> -----Original Message----- >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Dai >> Sent: Wednesday, November 16, 2016 10:41 AM >> To: dev@dpdk.org; Burakov, Anatoly; david.marchand@6wind.com; Dai, Wei >> Subject: [dpdk-dev] [PATCH v2] eal/linuxapp: fix return value check of mknod() >> >> In function pci_mknod_uio_dev() in lib/librte_eal/eal/eal_pci_uio.c, The return >> value of mknod() is ret, not f got by fopen(). >> So the value of ret should be checked for mknod(). >> >> Fixes: 67c536bdad93 ("pci: move uio mapping in a dedicated file") >> >> Signed-off-by: Wei Dai >> --- >> fix my local git setting and send same patch again to make merging easier >> >> lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c >> b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c >> index 1786b75..3e4ffb5 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c >> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c >> @@ -133,7 +133,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, >> unsigned uio_num) >> snprintf(filename, sizeof(filename), "/dev/uio%u", uio_num); >> dev = makedev(major, minor); >> ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev); >> - if (f == NULL) { >> + if (ret != 0) { > I think checkpatch will suggest to just use if (ret) Your are right, default checkpatch.pl complains about this usage (with --strict option), but: - According DPDK coding style this usage is preferred (although I personally prefer kernel one..) http://dpdk.org/doc/guides/contributing/coding_style.html#null-pointers " if (p == NULL) /* Good, compare pointer to NULL */ if (!p) /* Bad, using ! on pointer */ " - This warning disabled in dpdk scripts/checkpatches.sh by "--ignore COMPARISON_TO_NULL", so it shouldn't complain.