From f932fae8e09c50537c32945b2e92b129ef09b273 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Mon, 24 Nov 2025 22:31:25 +0000 Subject: [PATCH] Coderabbit Fixes --- emhttp/plugins/dynamix/include/SriovHelpers.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/emhttp/plugins/dynamix/include/SriovHelpers.php b/emhttp/plugins/dynamix/include/SriovHelpers.php index f8b006b5b..d11170f1d 100644 --- a/emhttp/plugins/dynamix/include/SriovHelpers.php +++ b/emhttp/plugins/dynamix/include/SriovHelpers.php @@ -180,7 +180,7 @@ function rebindVfDriver($vf, $sriov, $target = 'original') // Step 3: Override driver binding if (is_writable($drv_override)) @file_put_contents($drv_override, "$new_drv"); - $probe_path = "/sys/bus/pci/drivers_probe"; + $probe_path = "/sys/bus/pci/drivers_probe"; if (is_writable($probe_path)) @file_put_contents($probe_path, $vf); if (is_writable($drv_override)) @@ -278,7 +278,6 @@ function getVfListByIommuGroup(): array { $groups[] = $vf_pci; } - ksort($groups, SORT_NATURAL); return $groups; } @@ -323,7 +322,7 @@ function parseVFSettings() { if (preg_match($DBDF_SRIOV_SETTINGS_REGEX, $entry)) { // Format: ||| [$dbdf, $ven_dev, $vfio_flag, $mac] = explode('|', $entry); - if ($mac == "00:00:00:00:00:00") $mac = ""; + if ($mac === "00:00:00:00:00:00") $mac = ""; $sriov_devices_settings[$dbdf] = [ 'dbdf' => $dbdf, 'vendor' => $ven_dev, @@ -366,7 +365,7 @@ function setVfMacAddress(string $vf_pci, array $sriov, string $mac, ?string $reb 'details' => [] ]; - if ($mac != "" && preg_match('/([a-fA-F0-9]{2}[:|\-]?){6}/', $mac) != 1) { + if ($mac != "" && preg_match('/^([a-fA-F0-9]{2}[:\-]){5}[a-fA-F0-9]{2}$/', $mac) != 1) { $result['error'] = _("MAC format is invalid."); return $result; }