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


Groups > linux.kernel > #1299146

[PATCH] mISDN: correctly handling failed allocation in fsm

From Insu Yun <wuninsu@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] mISDN: correctly handling failed allocation in fsm
Date 2015-12-29 22:40 +0100
Message-ID <qLa9P-5VQ-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web