linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] PCI: Avoid access memory outside the resource window
@ 2018-06-05  1:46 Rex Zhu
  2018-06-05  1:46 ` [PATCH 2/2] PCI: Add check code for last image indicator not set Rex Zhu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rex Zhu @ 2018-06-05  1:46 UTC (permalink / raw)
  To: bhelgaas, michel.daenzer, alexander.deucher, linux-pci; +Cc: Rex Zhu

change ">" to ">=" to avoid access beyond the actual
length of io memory.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 drivers/pci/rom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 374a334..a5c6016 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -108,7 +108,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
 		length = readw(pds + 16);
 		image += length * 512;
 		/* Avoid iterating through memory outside the resource window */
-		if (image > rom + size)
+		if (image >= rom + size)
 			break;
 	} while (length && !last_image);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-30  2:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-05  1:46 [PATCH 1/2] PCI: Avoid access memory outside the resource window Rex Zhu
2018-06-05  1:46 ` [PATCH 2/2] PCI: Add check code for last image indicator not set Rex Zhu
2018-06-12 14:34 ` [PATCH 1/2] PCI: Avoid access memory outside the resource window Deucher, Alexander
2018-06-30  2:20 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).