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


Groups > linux.kernel > #1299146 > unrolled thread

[PATCH] mISDN: correctly handling failed allocation in fsm

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 in fsm Insu Yun <wuninsu@gmail.com> - 2015-12-29 22:40 +0100

#1299146 — [PATCH] mISDN: correctly handling failed allocation in fsm

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

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

diff --git a/drivers/isdn/mISDN/fsm.c b/drivers/isdn/mISDN/fsm.c
index 26477d4..3c3ffb0 100644
--- a/drivers/isdn/mISDN/fsm.c
+++ b/drivers/isdn/mISDN/fsm.c
@@ -34,6 +34,8 @@ mISDN_FsmNew(struct Fsm *fsm,
 
 	fsm->jumpmatrix = kzalloc(sizeof(FSMFNPTR) * fsm->state_count *
 				  fsm->event_count, GFP_KERNEL);
+	if (!fsm->jumpmatrix)
+		return;
 
 	for (i = 0; i < fncount; i++)
 		if ((fnlist[i].state >= fsm->state_count) ||
-- 
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