Skip to content

Commit 38d2265

Browse files
Aditya Pakkidavem330
authored andcommitted
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>
1 parent 72d8b4f commit 38d2265

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎drivers/isdn/hardware/mISDN/hfcsusb.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ hfcsusb_ph_info(struct hfcsusb *hw)
263263
int i;
264264

265265
phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC);
266+
if (!phi)
267+
return;
268+
266269
phi->dch.ch.protocol = hw->protocol;
267270
phi->dch.ch.Flags = dch->Flags;
268271
phi->dch.state = dch->state;

0 commit comments

Comments
 (0)