From 0a675fec8ce8c656179718a9edb14e4af72ef4f8 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Fri, 9 Sep 2022 17:40:08 +0200 Subject: [PATCH] Give libpci a bigger buffer to work with #224 --- src/detection/gpu/gpu_linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index 7b2f841b8..7b41fe8a4 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -46,7 +46,8 @@ static void pciDetectVendorName(FFGPUResult* gpu, PCIData* pci, struct pci_dev* if(gpu->vendor.length > 0) return; - pci->ffpci_lookup_name(pci->access, gpu->vendor.chars, (int) ffStrbufGetFree(&gpu->vendor), PCI_LOOKUP_VENDOR, device->vendor_id); + ffStrbufEnsureFree(&gpu->vendor, 255); + pci->ffpci_lookup_name(pci->access, gpu->vendor.chars, (int) gpu->vendor.allocated, PCI_LOOKUP_VENDOR, device->vendor_id); ffStrbufRecalculateLength(&gpu->vendor); if(ffStrbufFirstIndexS(&gpu->vendor, "AMD") < gpu->vendor.length || ffStrbufFirstIndexS(&gpu->vendor, "ATI") < gpu->vendor.length) @@ -84,7 +85,8 @@ static void pciDetectDeviceName(FFGPUResult* gpu, PCIData* pci, struct pci_dev* return; } - pci->ffpci_lookup_name(pci->access, gpu->name.chars, (int) ffStrbufGetFree(&gpu->name), PCI_LOOKUP_DEVICE, device->vendor_id, device->device_id); + ffStrbufEnsureFree(&gpu->name, 255); + pci->ffpci_lookup_name(pci->access, gpu->name.chars, (int) gpu->name.allocated, PCI_LOOKUP_DEVICE, device->vendor_id, device->device_id); ffStrbufRecalculateLength(&gpu->name); }