]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_pci/rte_pci.c
pci: explain how empty strings are rejected in DBDF
[dpdk.git] / lib / librte_pci / rte_pci.c
index 5f7726fa89d5038b1e4d0f9418359d1220d5ea82..9c80c4b71dc03f08b49a66279cca78db3029ccf3 100644 (file)
@@ -84,6 +84,10 @@ pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)
 
        errno = 0;
        val = strtoul(in, &end, 16);
+       /* Empty string is not an error for strtoul, but the check
+        *   end[0] != ':'
+        * will detect the issue.
+        */
        if (errno != 0 || end[0] != ':' || val > UINT32_MAX)
                return -EINVAL;
        dev_addr->domain = (uint32_t)val;