Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Arvind Yadav and committed by
Borislav Petkov
f5c61277 eca90a3b

+4
+4
drivers/edac/i82975x_edac.c
··· 494 494 } 495 495 mchbar &= 0xffffc000; /* bits 31:14 used for 16K window */ 496 496 mch_window = ioremap_nocache(mchbar, 0x1000); 497 + if (!mch_window) { 498 + edac_dbg(3, "error ioremapping MCHBAR!\n"); 499 + goto fail0; 500 + } 497 501 498 502 #ifdef i82975x_DEBUG_IOMEM 499 503 i82975x_printk(KERN_INFO, "MCHBAR real = %0x, remapped = %p\n",