[SeaBIOS] [PATCH v2 1/3] pci: fix the return value for truncated capability

Jing Liu posted 3 patches 7 years, 4 months ago
There is a newer version of this series
[SeaBIOS] [PATCH v2 1/3] pci: fix the return value for truncated capability
Posted by Jing Liu 7 years, 4 months ago
Return zero when finding truncated capability.

Signed-off-by: Jing Liu <jing2.liu@linux.intel.com>
---
 src/fw/pciinit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
index 3a2f747..d2cea2b 100644
--- a/src/fw/pciinit.c
+++ b/src/fw/pciinit.c
@@ -539,6 +539,7 @@ static u8 pci_find_resource_reserve_capability(u16 bdf)
             if (cap_len < RES_RESERVE_CAP_SIZE) {
                 dprintf(1, "PCI: QEMU resource reserve cap length %d is invalid\n",
                         cap_len);
+                return 0;
             }
         }
         return cap;
-- 
1.8.3.1


_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH v2 1/3] pci: fix the return value for truncated capability
Posted by Marcel Apfelbaum 7 years, 3 months ago

On 08/16/2018 05:32 AM, Jing Liu wrote:
> Return zero when finding truncated capability.
>
> Signed-off-by: Jing Liu <jing2.liu@linux.intel.com>
> ---
>   src/fw/pciinit.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
> index 3a2f747..d2cea2b 100644
> --- a/src/fw/pciinit.c
> +++ b/src/fw/pciinit.c
> @@ -539,6 +539,7 @@ static u8 pci_find_resource_reserve_capability(u16 bdf)
>               if (cap_len < RES_RESERVE_CAP_SIZE) {
>                   dprintf(1, "PCI: QEMU resource reserve cap length %d is invalid\n",
>                           cap_len);
> +                return 0;
>               }
>           }
>           return cap;

Reviewed-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com>


Thanks,
Marcel

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios