]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev/net_id: fix signedness in format string
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 17 Dec 2021 10:29:57 +0000 (11:29 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 17 Dec 2021 10:45:55 +0000 (11:45 +0100)
Both variables are unsigned. In practice those numbers cannot be large
enough to become negative, but let's use the correct type anyway.

src/udev/udev-builtin-net_id.c

index 4d165917509006f92a9079e95e535f606e0e1310..4ca826b58e0d9b223cc964a06934a50efdebd405 100644 (file)
@@ -443,10 +443,10 @@ static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) {
                 s = names->pci_slot;
                 l = sizeof(names->pci_slot);
                 if (domain > 0)
-                        l = strpcpyf(&s, l, "P%d", domain);
+                        l = strpcpyf(&s, l, "P%u", domain);
                 l = strpcpyf(&s, l, "s%"PRIu32, hotplug_slot);
                 if (func > 0 || is_pci_multifunction(names->pcidev))
-                        l = strpcpyf(&s, l, "f%d", func);
+                        l = strpcpyf(&s, l, "f%u", func);
                 if (!isempty(info->phys_port_name))
                         l = strpcpyf(&s, l, "n%s", info->phys_port_name);
                 else if (dev_port > 0)