pci: reject negative values in PCI id
authorGaetan Rivet <grive@u256.net>
Wed, 13 May 2020 10:47:50 +0000 (12:47 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 19 May 2020 09:18:38 +0000 (11:18 +0200)
commit21a61fae51804cfdf7c6f7e6189c63f02025de89
tree8b4fcb52d6d4f6dd7c52c3ae3c67dd77308c4f47
parent26cfc20feddd9fc5b87842d4c9bda6b9453e2c46
pci: reject negative values in PCI id

The function strtoul will not return ERANGE if the input is negative, as
one might expect.

   0000:-FFFFFFFFFFFFFFFB:00.0

is not a better way to write 0000:05:00.0.
To simplify checking for '-', forbid using spaces before the field value.

   0000: 00:   2c.0

Should not be accepted.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Gaetan Rivet <grive@u256.net>
Acked-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
lib/librte_pci/rte_pci.c