Skip to content

Commit

Permalink
Merge "tzlog : Add check to avoid null pointer dereferencing"
Browse files Browse the repository at this point in the history
  • Loading branch information
qctecmdr authored and Gerrit - the friendly Code Review server committed May 26, 2022
2 parents 6dd9e34 + 19a07ca commit 7f3f920
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/firmware/qcom/tz_log.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/debugfs.h>
#include <linux/errno.h>
Expand Down Expand Up @@ -1238,8 +1239,15 @@ static ssize_t tzdbgfs_read(struct file *file, char __user *buf,
struct seq_file *seq = file->private_data;
int tz_id = TZDBG_STATS_MAX;

if (seq)
tz_id = *(int *)(seq->private);
if (seq) {
if (seq->private)
tz_id = *(int *)(seq->private);
else {
pr_err("%s: Seq data private null unable to proceed\n",
__func__);
return 0;
}
}
else {
pr_err("%s: Seq data null unable to proceed\n", __func__);
return 0;
Expand Down

0 comments on commit 7f3f920

Please sign in to comment.