From: Wang YanQing <udknight@gmail.com>
To: tomi.valkeinen@ti.com
Cc: pjones@redhat.com, dh.herrmann@gmail.com, hpa@zytor.com,
linux-kernel@vger.kernel.org, x86@kernel.org
Subject: [PATCH] x86:sysfb_efi:efifb_set_system: fix miss valid address range in later BARs
Date: Mon, 11 Apr 2016 11:22:21 +0800 [thread overview]
Message-ID: <20160411032221.GA13983@udknight> (raw)
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
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
arch/x86/kernel/sysfb_efi.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/sysfb_efi.c b/arch/x86/kernel/sysfb_efi.c
index b285d4e..ac0b521 100644
--- a/arch/x86/kernel/sysfb_efi.c
+++ b/arch/x86/kernel/sysfb_efi.c
@@ -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) {
--
1.8.5.6.2.g3d8a54e.dirty
reply other threads:[~2016-04-10 19:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160411032221.GA13983@udknight \
--to=udknight@gmail.com \
--cc=dh.herrmann@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pjones@redhat.com \
--cc=tomi.valkeinen@ti.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®