Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1299147 > unrolled thread

[PATCH] mISDN: correctly handling failed allocation

Started byInsu Yun <wuninsu@gmail.com>
First post2015-12-29 22:40 +0100
Last post2015-12-29 22:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] mISDN: correctly handling failed allocation Insu Yun <wuninsu@gmail.com> - 2015-12-29 22:40 +0100

#1299147 — [PATCH] mISDN: correctly handling failed allocation

FromInsu Yun <wuninsu@gmail.com>
Date2015-12-29 22:40 +0100
Subject[PATCH] mISDN: correctly handling failed allocation
Message-ID<qLa9P-5VQ-11@gated-at.bofh.it>
Since kzalloc can be failed in memory pressure,
NULL dereference might be happened.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/isdn/hardware/mISDN/hfcsusb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 114f3bc..15164e9 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -264,6 +264,9 @@ hfcsusb_ph_info(struct hfcsusb *hw)
 
 	phi = kzalloc(sizeof(struct ph_info) +
 		      dch->dev.nrbchan * sizeof(struct ph_info_ch), GFP_ATOMIC);
+	if (!phi)
+		return;
+
 	phi->dch.ch.protocol = hw->protocol;
 	phi->dch.ch.Flags = dch->Flags;
 	phi->dch.state = dch->state;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web