Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1559471 > unrolled thread

[PATCH v1] edac: i82975x_edac :- Handle return NULL error from ioremap_nocache

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-01-16 07:50 +0100
Last post2017-01-16 11:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v1] edac: i82975x_edac :- Handle return NULL error from ioremap_nocache Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-01-16 07:50 +0100
    Re: [PATCH v1] edac: i82975x_edac :- Handle return NULL error from  ioremap_nocache Borislav Petkov <bp@alien8.de> - 2017-01-16 11:50 +0100

#1559471 — [PATCH v1] edac: i82975x_edac :- Handle return NULL error from ioremap_nocache

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-01-16 07:50 +0100
Subject[PATCH v1] edac: i82975x_edac :- Handle return NULL error from ioremap_nocache
Message-ID<t09h7-4Tq-1@gated-at.bofh.it>
Here, If ioremap_nocache will fail. It will return NULL.
Kernel can run into a NULL-pointer dereference.
This error check will avoid NULL pointer dereference.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/edac/i82975x_edac.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/edac/i82975x_edac.c b/drivers/edac/i82975x_edac.c
index 7baa8ac..e747d82 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, "failed to memory map!\n");
+		goto fail0;
+	}
 
 #ifdef i82975x_DEBUG_IOMEM
 	i82975x_printk(KERN_INFO, "MCHBAR real = %0x, remapped = %p\n",
-- 
1.9.1

[toc] | [next] | [standalone]


#1559628 — Re: [PATCH v1] edac: i82975x_edac :- Handle return NULL error from ioremap_nocache

FromBorislav Petkov <bp@alien8.de>
Date2017-01-16 11:50 +0100
SubjectRe: [PATCH v1] edac: i82975x_edac :- Handle return NULL error from ioremap_nocache
Message-ID<t0d1o-7E3-11@gated-at.bofh.it>
In reply to#1559471
On Mon, Jan 16, 2017 at 12:14:52PM +0530, Arvind Yadav wrote:
> Here, If ioremap_nocache will fail. It will return NULL.
> Kernel can run into a NULL-pointer dereference.
> This error check will avoid NULL pointer dereference.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/edac/i82975x_edac.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/edac/i82975x_edac.c b/drivers/edac/i82975x_edac.c
> index 7baa8ac..e747d82 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, "failed to memory map!\n");
> +		goto fail0;
> +	}
>  
>  #ifdef i82975x_DEBUG_IOMEM
>  	i82975x_printk(KERN_INFO, "MCHBAR real = %0x, remapped = %p\n",
> -- 

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web