Skip to content

Commit

Permalink
isdn: mISDNinfineon: fix potential NULL pointer dereference
Browse files Browse the repository at this point in the history
In case ioremap fails, the fix returns -ENOMEM to avoid NULL
pointer dereference.

Signed-off-by: Kangjie Lu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
kengiter authored and davem330 committed Mar 10, 2019
1 parent 69b51bb commit d721fe9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/isdn/hardware/mISDN/mISDNinfineon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d721fe9

Please sign in to comment.