summaryrefslogtreecommitdiffstats
path: root/drivers/edac/i82975x_edac.c
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2017-01-16 07:44:52 +0100
committerBorislav Petkov <bp@suse.de>2017-01-16 11:09:22 +0100
commitf5c61277f67f03df334c4486397ecff54968971b (patch)
treee9b494099de12ae0e23eefa0013dcad3fe66eb3e /drivers/edac/i82975x_edac.c
parentEDAC: Fix typos in enum mem_type comments (diff)
downloadlinux-f5c61277f67f03df334c4486397ecff54968971b.tar.xz
linux-f5c61277f67f03df334c4486397ecff54968971b.zip
EDAC, i82975x: Add ioremap_nocache() error handling
If ioremap_nocache() fails, it will return NULL. Which will then cause a NULL-pointer dereference. Handle the returned value properly. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: "Arvind R." <arvino55@gmail.com> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/1484549092-11349-1-git-send-email-arvind.yadav.cs@gmail.com [ Boris: massage commit message and improve error message. ] Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac/i82975x_edac.c')
-rw-r--r--drivers/edac/i82975x_edac.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/edac/i82975x_edac.c b/drivers/edac/i82975x_edac.c
index 7baa8ace267b..9dcdab28f665 100644
--- a/drivers/edac/i82975x_edac.c
+++ b/drivers/edac/i82975x_edac.c
@@ -494,6 +494,10 @@ static int i82975x_probe1(struct pci_dev *pdev, int dev_idx)
}
mchbar &= 0xffffc000; /* bits 31:14 used for 16K window */
mch_window = ioremap_nocache(mchbar, 0x1000);
+ if (!mch_window) {
+ edac_dbg(3, "error ioremapping MCHBAR!\n");
+ goto fail0;
+ }
#ifdef i82975x_DEBUG_IOMEM
i82975x_printk(KERN_INFO, "MCHBAR real = %0x, remapped = %p\n",