Skip to contentSkip to conversation

x86:sysfb_efi:efifb_set_system: fix miss valid address range in later BARs

PATCH Superseded Wang YanQing 1 participant 1 message Apr 10, 2016 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86:sysfb_efi:efifb_set_system: fix miss valid address range in later BARs

We can't just break out when meet start is equal to zero, this will cause we miss valid address range in later BARs.

On the other hand, it isn't enough to test start only for below situation:
0(start) <= lfb_base < end

---
 arch/x86/kernel/sysfb_efi.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/x86/kernel/sysfb_efi.c +11 -2
index b285d4e..ac0b521 100644
@@ -106,10 +106,19 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
 					continue;
 				for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
 					resource_size_t start, end;
+					unsigned long flags;
+
+					flags = pci_resource_flags(dev, i);
+					if (!(flags & IORESOURCE_MEM))
+						continue;
+
+					if (flags & IORESOURCE_UNSET)
+						continue;
+
+					if (pci_resource_len(dev, i) == 0)
+						continue;
 
 					start = pci_resource_start(dev, i);
-					if (start == 0)
-						break;
 					end = pci_resource_end(dev, i);
 					if (screen_info.lfb_base >= start &&
 					    screen_info.lfb_base < end) {
Signature · 1 line
1.8.5.6.2.g3d8a54e.dirty