linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: vpss: fix a potential NULL pointer dereference
@ 2019-03-23  2:51 Kangjie Lu
  2019-03-26  9:46 ` Lad, Prabhakar
  2019-03-27 12:58 ` Mukesh Ojha
  0 siblings, 2 replies; 5+ messages in thread
From: Kangjie Lu @ 2019-03-23  2:51 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Lad, Prabhakar, Mauro Carvalho Chehab, linux-media,
	linux-kernel

In case ioremap fails, the fix returns -ENOMEM to avoid NULL
pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/media/platform/davinci/vpss.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c
index 19cf6853411e..89a86c19579b 100644
--- a/drivers/media/platform/davinci/vpss.c
+++ b/drivers/media/platform/davinci/vpss.c
@@ -518,6 +518,11 @@ static int __init vpss_init(void)
 		return -EBUSY;
 
 	oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4);
+	if (unlikely(!oper_cfg.vpss_regs_base2)) {
+		release_mem_region(VPSS_CLK_CTRL, 4);
+		return -ENOMEM;
+	}
+
 	writel(VPSS_CLK_CTRL_VENCCLKEN |
 		     VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] media: vpss: fix a potential NULL pointer dereference
@ 2019-03-09  6:53 Kangjie Lu
  2019-03-27 13:33 ` Mukesh Ojha
  0 siblings, 1 reply; 5+ messages in thread
From: Kangjie Lu @ 2019-03-09  6:53 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Lad, Prabhakar, Mauro Carvalho Chehab, linux-media,
	linux-kernel

In case ioremap fails, the fix returns -ENOMEM to avoid NULL
pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/media/platform/davinci/vpss.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c
index 19cf6853411e..f7beed2de9cb 100644
--- a/drivers/media/platform/davinci/vpss.c
+++ b/drivers/media/platform/davinci/vpss.c
@@ -518,6 +518,9 @@ static int __init vpss_init(void)
 		return -EBUSY;
 
 	oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4);
+	if (unlikely(!oper_cfg.vpss_regs_base2))
+		return -ENOMEM;
+
 	writel(VPSS_CLK_CTRL_VENCCLKEN |
 		     VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
 
-- 
2.17.1


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

end of thread, other threads:[~2019-03-27 13:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-23  2:51 [PATCH] media: vpss: fix a potential NULL pointer dereference Kangjie Lu
2019-03-26  9:46 ` Lad, Prabhakar
2019-03-27 12:58 ` Mukesh Ojha
  -- strict thread matches above, loose matches on Subject: below --
2019-03-09  6:53 Kangjie Lu
2019-03-27 13:33 ` Mukesh Ojha

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).