From b68453c17052a25cc335e658c3be99b53b3e75a0 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Fri, 16 Apr 2021 11:18:41 +0900 Subject: [PATCH] misc: tizen-inform-reboot: fix a potential NULL pointer dereference Fix a potential NULL pointer dereference. If there is no file or directory, it has to check whether it's error or not. Change-Id: Ia6e7280c1901ae772a5f890c312b7a741fbac0a1 Signed-off-by: Jaehoon Chung --- drivers/misc/tizen-inform-reboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/tizen-inform-reboot.c b/drivers/misc/tizen-inform-reboot.c index affc54a..9a9ed92 100644 --- a/drivers/misc/tizen-inform-reboot.c +++ b/drivers/misc/tizen-inform-reboot.c @@ -27,7 +27,7 @@ static int inform_reboot_notifier(struct notifier_block *nb, mm_segment_t old_fs = force_uaccess_begin(); file = filp_open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644); - if (file) { + if (!IS_ERR(file)) { struct super_block *sb = file->f_path.dentry->d_sb; if (cmd) { -- 2.7.4