Skip to content

Commit

Permalink
fix: avoid potential index out of range error if ls-iommu cannot find…
Browse files Browse the repository at this point in the history
… a vbios path

Signed-off-by: HikariKnight <[email protected]>
  • Loading branch information
jedrw authored and HikariKnight committed Jan 6, 2025
1 parent 0efcf4e commit c1f11ce
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/pages/03_vbios_extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ func genVBIOS_dumper(config *configs.Config) {
scriptdir, _ = os.Getwd()
}

// Get the vbios path and generate the vbios dumping script
vbios_path := lsiommu.GetIOMMU("-g", "-i", config.Gpu_Group, "--rom")[0]
configs.GenerateVBIOSDumper(vbios_path)
// Search for a vbios path and generate the vbios dumping script if found
vbios_paths := lsiommu.GetIOMMU("-g", "-i", config.Gpu_Group, "--rom")
if len(vbios_paths) != 0 {
configs.GenerateVBIOSDumper(vbios_paths[0])
}

// Make the qemu config folder
os.Mkdir(fmt.Sprintf("%s/%s", scriptdir, config.Path.QEMU), os.ModePerm)
Expand All @@ -51,7 +53,7 @@ func genVBIOS_dumper(config *configs.Config) {
"rom to the VM along with the card in order to get a functional passthrough.\n",
"In many cases you can find your vbios at https://www.techpowerup.com/vgabios/\n",
"\n",
"You can also attempt to dump your own vbios from TTY using the script in\n",
"If we found a romfile for your GPU you can also attempt to dump your own vbios from TTY using the script in\n",
fmt.Sprintf("%s/utils/dump_vbios.sh\n", scriptdir),
"\n",
)
Expand Down

1 comment on commit c1f11ce

@HikariKnight
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i totally didn't accidentally remove this merge when i applied a different fix 🤦
anyways i added it back, no damage done 😅

originally from PR #31

Please sign in to comment.