[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1453582366-23407-1-git-send-email-wuninsu@gmail.com>
Date: Sat, 23 Jan 2016 15:52:46 -0500
From: Insu Yun <wuninsu@...il.com>
To: gregkh@...uxfoundation.org, jslaby@...e.com,
linux-kernel@...r.kernel.org
Cc: taesoo@...ech.edu, yeongjin.jang@...ech.edu, insu@...ech.edu,
changwoo@...ech.edu, Insu Yun <wuninsu@...il.com>
Subject: [PATCH] vt: correctly check return value of class_create
Since class_create can be failed in memory pressure,
its return value should be checked and correctly handled.
Signed-off-by: Insu Yun <wuninsu@...il.com>
---
drivers/tty/vt/vc_screen.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
index 14a2b5f..5df4bc1 100644
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -644,6 +644,8 @@ int __init vcs_init(void)
if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops))
panic("unable to get major %d for vcs device", VCS_MAJOR);
vc_class = class_create(THIS_MODULE, "vc");
+ if (IS_ERR(vc_class))
+ return PTR_ERR(vc_class);
device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
--
1.9.1
Powered by blists - more mailing lists