systemd/0079-backport-udev-net_id-parse-_SUN-ACPI-index-as-a-signed-intege.patch
2021-05-30 22:04:06 -04:00

47 lines
1.8 KiB
Diff

From 3e545ae5abcf258791eacbee60c829c100a33274 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Sekleta=CC=81r?= <msekleta@redhat.com>
Date: Mon, 19 Oct 2020 10:56:11 +0200
Subject: [PATCH] udev/net_id: parse _SUN ACPI index as a signed integer
Negative value means there is no match between a PCI device and any of
the slots. In the following commit we will extend this and value of 0
will indicate that there is a match between some slot and PCI device,
but that device is a PCI bridge.
---
src/udev/udev-builtin-net_id.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index b82fd88..99d44a2 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -246,7 +246,8 @@ static bool is_pci_ari_enabled(sd_device *dev) {
static int dev_pci_slot(sd_device *dev, struct netnames *names) {
unsigned long dev_port = 0;
- unsigned domain, bus, slot, func, hotplug_slot = 0;
+ unsigned domain, bus, slot, func;
+ int hotplug_slot = -1;
size_t l;
char *s;
const char *sysname, *attr, *port_name = NULL, *syspath;
@@ -327,13 +328,13 @@ static int dev_pci_slot(sd_device *dev, struct netnames *names) {
continue;
FOREACH_DIRENT_ALL(dent, dir, break) {
- unsigned i;
+ int i;
char str[PATH_MAX];
_cleanup_free_ char *address = NULL;
if (dent->d_name[0] == '.')
continue;
- r = safe_atou_full(dent->d_name, 10, &i);
+ r = safe_atoi(dent->d_name, &i);
if (r < 0 || i <= 0)
continue;
--
2.23.0