lkml.org 
[lkml]   [2016]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 4/4] ACPI: PCI: Add generic PCI host controller
From
Date
On 4/11/2016 6:45 PM, Jayachandran C wrote:
> +/* find the entry in cfgarr which contains range bus_start..bus_end */
> +static int mcfg_lookup(u16 seg, u8 bus_start, u8 bus_end)
> +{
> + struct pci_config_window *cfg;
> + int i;
> +
> + if (!cfgarr)
> + return -ENOENT;
> +
> + for (i = 0; cfgarr[i]; i++) {
> + cfg = cfgarr[i];
> +

I see that you are allocating an array of cfgarr to keep the MCFG table entries.
The above way of checking the number of entries is not correct.

You should keep track of the number of entries you found out globally instead of
relying an element being NULL or not.

If you exceed the array size, you may or may not be lucky to find another entry
in memory.

--
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

\
 
 \ /
  Last update: 2016-04-14 18:01    [W:0.071 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site