[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190130101902.19744-1-yuehaibing@huawei.com>
Date:   Wed, 30 Jan 2019 18:19:02 +0800
From:   YueHaibing <yuehaibing@...wei.com>
To:     <isdn@...ux-pingi.de>, <davem@...emloft.net>,
        <gustavo@...eddedor.com>, <bigeasy@...utronix.de>
CC:     <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
        YueHaibing <yuehaibing@...wei.com>
Subject: [PATCH -next] mISDN: hfcsusb: Fix potential NULL pointer dereference
There is a potential NULL pointer dereference in case
kzalloc() fails and returns NULL.
Fixes: 69f52adb2d53 ("mISDN: Add HFC USB driver")
Signed-off-by: YueHaibing <yuehaibing@...wei.com>
---
 drivers/isdn/hardware/mISDN/hfcsusb.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 124ff53..5660d5a 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -263,6 +263,8 @@ 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;
-- 
2.7.0
Powered by blists - more mailing lists
 
