linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rex Zhu <Rex.Zhu@amd.com>
To: <bhelgaas@google.com>, <michel.daenzer@amd.com>,
	<alexander.deucher@amd.com>, <linux-pci@vger.kernel.org>
Cc: Rex Zhu <Rex.Zhu@amd.com>
Subject: [PATCH 1/2] PCI: Avoid access memory outside the resource window
Date: Tue, 5 Jun 2018 09:46:45 +0800	[thread overview]
Message-ID: <1528163206-4136-1-git-send-email-Rex.Zhu@amd.com> (raw)

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

             reply	other threads:[~2018-06-05  1:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05  1:46 Rex Zhu [this message]
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

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=1528163206-4136-1-git-send-email-Rex.Zhu@amd.com \
    --to=rex.zhu@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=michel.daenzer@amd.com \
    /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;
as well as URLs for NNTP newsgroup(s).