summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorFiroz Khan <firozk@codeaurora.org>2019-02-27 15:46:13 +0530
committerFiroz Khan <firozk@codeaurora.org>2019-02-27 15:46:13 +0530
commit40a11add8b4a6846a3ac53af5d8374ebc47591c8 (patch)
tree756157641b3a3224a8c471ce2fcbe837b53786ec /drivers/char
parente2a34f151c7bc7adb99fb673973fbef69e63dce6 (diff)
msm: adsprpc: perform NULL check
Perfrom NULL check with return value of kzalloc in order to avoid NULL pointer dereference. Change-Id: Ic45cc702b19a87d851b75595e1cf86e1674dd9d4 Signed-off-by: Firoz Khan <firozk@codeaurora.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/adsprpc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c
index b042a3d57de9..bd76abfa10ee 100644
--- a/drivers/char/adsprpc.c
+++ b/drivers/char/adsprpc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -2932,7 +2932,11 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
return err;
snprintf(strpid, PID_SIZE, "%d", current->pid);
buf_size = strlen(current->comm) + strlen("_") + strlen(strpid) + 1;
- fl->debug_buf = kzalloc(buf_size, GFP_KERNEL);
+ VERIFY(err, NULL != (fl->debug_buf = kzalloc(buf_size, GFP_KERNEL)));
+ if (err) {
+ kfree(fl);
+ return err;
+ }
snprintf(fl->debug_buf, UL_SIZE, "%.10s%s%d",
current->comm, "_", current->pid);
debugfs_file = debugfs_create_file(fl->debug_buf, 0644,