[PATCH] udev: Allow acpi_index and index to be "0"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



0 can be a valid index returned by the BIOS, so allow that literal while
still checking for 0 as a failed conversion by strtoul(). Also, unsigned
long cannot be negative, so don't misleadingly check for less than 0.

Signed-off-by: Joe Hershberger <joe.hershberger@xxxxxx>
---
 src/udev/udev-builtin-net_id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 5341d3788..338a2d4c4 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -232,7 +232,7 @@ static int dev_pci_onboard(struct udev_device *dev, struct netnames *names) {
                 return -ENOENT;
 
         idx = strtoul(attr, NULL, 0);
-        if (idx <= 0)
+        if (idx == 0 && strcmp("0", attr))
                 return -EINVAL;
 
         /* Some BIOSes report rubbish indexes that are excessively high (2^24-1 is an index VMware likes to report for
-- 
2.11.0

_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux