Skip to content

Commit f932fae

Browse files
committed
Coderabbit Fixes
1 parent 837c650 commit f932fae

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

emhttp/plugins/dynamix/include/SriovHelpers.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function rebindVfDriver($vf, $sriov, $target = 'original')
180180
// Step 3: Override driver binding
181181
if (is_writable($drv_override))
182182
@file_put_contents($drv_override, "$new_drv");
183-
$probe_path = "/sys/bus/pci/drivers_probe";
183+
$probe_path = "/sys/bus/pci/drivers_probe";
184184
if (is_writable($probe_path))
185185
@file_put_contents($probe_path, $vf);
186186
if (is_writable($drv_override))
@@ -278,7 +278,6 @@ function getVfListByIommuGroup(): array {
278278
$groups[] = $vf_pci;
279279
}
280280

281-
ksort($groups, SORT_NATURAL);
282281
return $groups;
283282
}
284283

@@ -323,7 +322,7 @@ function parseVFSettings() {
323322
if (preg_match($DBDF_SRIOV_SETTINGS_REGEX, $entry)) {
324323
// Format: <DBDF>|<Vendor:Device>|<VFIO_flag>|<MAC>
325324
[$dbdf, $ven_dev, $vfio_flag, $mac] = explode('|', $entry);
326-
if ($mac == "00:00:00:00:00:00") $mac = "";
325+
if ($mac === "00:00:00:00:00:00") $mac = "";
327326
$sriov_devices_settings[$dbdf] = [
328327
'dbdf' => $dbdf,
329328
'vendor' => $ven_dev,
@@ -366,7 +365,7 @@ function setVfMacAddress(string $vf_pci, array $sriov, string $mac, ?string $reb
366365
'details' => []
367366
];
368367

369-
if ($mac != "" && preg_match('/([a-fA-F0-9]{2}[:|\-]?){6}/', $mac) != 1) {
368+
if ($mac != "" && preg_match('/^([a-fA-F0-9]{2}[:\-]){5}[a-fA-F0-9]{2}$/', $mac) != 1) {
370369
$result['error'] = _("MAC format is invalid.");
371370
return $result;
372371
}

0 commit comments

Comments
 (0)