From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754884AbcAWUuc (ORCPT ); Sat, 23 Jan 2016 15:50:32 -0500 Received: from mail-yk0-f172.google.com ([209.85.160.172]:34074 "EHLO mail-yk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754267AbcAWUu3 (ORCPT ); Sat, 23 Jan 2016 15:50:29 -0500 From: Insu Yun To: gregkh@linuxfoundation.org, jslaby@suse.com, linux-kernel@vger.kernel.org Cc: taesoo@gatech.edu, yeongjin.jang@gatech.edu, insu@gatech.edu, changwoo@gatech.edu, Insu Yun Subject: [PATCH] vt: correctly check return value of class_create Date: Sat, 23 Jan 2016 15:52:46 -0500 Message-Id: <1453582366-23407-1-git-send-email-wuninsu@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since class_create can be failed in memory pressure, its return value should be checked and correctly handled. Signed-off-by: Insu Yun --- 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