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: Aditya Pakki <pakki001@umn.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
72d8b4fdbf
commit
38d2265980
|
@ -263,6 +263,9 @@ hfcsusb_ph_info(struct hfcsusb *hw)
|
|||
int i;
|
||||
|
||||
phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC);
|
||||
if (!phi)
|
||||
return;
|
||||
|
||||
phi->dch.ch.protocol = hw->protocol;
|
||||
phi->dch.ch.Flags = dch->Flags;
|
||||
phi->dch.state = dch->state;
|
||||
|
|
Loading…
Reference in New Issue