linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] isdn: mISDNinfineon: fix potential NULL pointer dereference
@ 2019-03-09  5:49 Kangjie Lu
  2019-03-10 17:58 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-09  5:49 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Karsten Keil, David S. Miller, Gustavo A. R. Silva,
	netdev, linux-kernel

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

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/isdn/hardware/mISDN/mISDNinfineon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/hardware/mISDN/mISDNinfineon.c b/drivers/isdn/hardware/mISDN/mISDNinfineon.c
index 3e01012be4ab..0fe6ddcb3fdc 100644
--- a/drivers/isdn/hardware/mISDN/mISDNinfineon.c
+++ b/drivers/isdn/hardware/mISDN/mISDNinfineon.c
@@ -712,8 +712,11 @@ setup_io(struct inf_hw *hw)
 				(ulong)hw->addr.start, (ulong)hw->addr.size);
 			return err;
 		}
-		if (hw->ci->addr_mode == AM_MEMIO)
+		if (hw->ci->addr_mode == AM_MEMIO) {
 			hw->addr.p = ioremap(hw->addr.start, hw->addr.size);
+			if (unlikely(!hw->addr.p))
+				return -ENOMEM;
+		}
 		hw->addr.mode = hw->ci->addr_mode;
 		if (debug & DEBUG_HW)
 			pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n",
-- 
2.17.1


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

* Re: [PATCH] isdn: mISDNinfineon: fix potential NULL pointer dereference
  2019-03-09  5:49 [PATCH] isdn: mISDNinfineon: fix potential NULL pointer dereference Kangjie Lu
@ 2019-03-10 17:58 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-03-10 17:58 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, isdn, gustavo, netdev, linux-kernel

From: Kangjie Lu <kjlu@umn.edu>
Date: Fri,  8 Mar 2019 23:49:34 -0600

> In case ioremap fails, the fix returns -ENOMEM to avoid NULL
> pointer dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Applied.

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

end of thread, other threads:[~2019-03-10 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09  5:49 [PATCH] isdn: mISDNinfineon: fix potential NULL pointer dereference Kangjie Lu
2019-03-10 17:58 ` David Miller

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