提交 cc548166 编写于 作者: D Dan Carpenter 提交者: Joel Becker

ocfs2/cluster: dereferencing before checking in nst_seq_show()

In the original code, we dereferenced "nst" before checking that it was
non-NULL.  I moved the check forward and pulled the code in an indent
level.
Signed-off-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NJoel Becker <joel.becker@oracle.com>
上级 e70d8450
...@@ -133,13 +133,14 @@ static int nst_seq_show(struct seq_file *seq, void *v) ...@@ -133,13 +133,14 @@ static int nst_seq_show(struct seq_file *seq, void *v)
spin_lock(&o2net_debug_lock); spin_lock(&o2net_debug_lock);
nst = next_nst(dummy_nst); nst = next_nst(dummy_nst);
if (!nst)
goto out;
now = ktime_get(); now = ktime_get();
sock = ktime_to_us(ktime_sub(now, nst->st_sock_time)); sock = ktime_to_us(ktime_sub(now, nst->st_sock_time));
send = ktime_to_us(ktime_sub(now, nst->st_send_time)); send = ktime_to_us(ktime_sub(now, nst->st_send_time));
status = ktime_to_us(ktime_sub(now, nst->st_status_time)); status = ktime_to_us(ktime_sub(now, nst->st_status_time));
if (nst != NULL) {
/* get_task_comm isn't exported. oh well. */ /* get_task_comm isn't exported. oh well. */
seq_printf(seq, "%p:\n" seq_printf(seq, "%p:\n"
" pid: %lu\n" " pid: %lu\n"
...@@ -161,8 +162,8 @@ static int nst_seq_show(struct seq_file *seq, void *v) ...@@ -161,8 +162,8 @@ static int nst_seq_show(struct seq_file *seq, void *v)
(long long)sock, (long long)sock,
(long long)send, (long long)send,
(long long)status); (long long)status);
}
out:
spin_unlock(&o2net_debug_lock); spin_unlock(&o2net_debug_lock);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册