Commit 38d22659 authored by Aditya Pakki's avatar Aditya Pakki Committed by David S. Miller

isdn: mISDN: Fix potential NULL pointer dereference of kzalloc

Allocating memory via kzalloc for phi may fail and causes a
NULL pointer dereference. This patch avoids such a scenario.
Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 72d8b4fd
...@@ -263,6 +263,9 @@ hfcsusb_ph_info(struct hfcsusb *hw) ...@@ -263,6 +263,9 @@ hfcsusb_ph_info(struct hfcsusb *hw)
int i; int i;
phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC); phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC);
if (!phi)
return;
phi->dch.ch.protocol = hw->protocol; phi->dch.ch.protocol = hw->protocol;
phi->dch.ch.Flags = dch->Flags; phi->dch.ch.Flags = dch->Flags;
phi->dch.state = dch->state; phi->dch.state = dch->state;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment