aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/cluster/netdebug.c
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-01-03 01:00:20 -0500
committerJoel Becker <joel.becker@oracle.com>2011-01-07 21:02:03 -0500
commitcc548166b2aadba7a566fb0a42884a9d2ff684b0 (patch)
tree4f9a36e151bcc12670fa7d9e92aafd0d98754f26 /fs/ocfs2/cluster/netdebug.c
parente70d84501b630e390b4242fb4ac629b694c11484 (diff)
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: Dan Carpenter <error27@gmail.com> Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/cluster/netdebug.c')
-rw-r--r--fs/ocfs2/cluster/netdebug.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c
index 61df89cedded..3a5835904b3d 100644
--- a/fs/ocfs2/cluster/netdebug.c
+++ b/fs/ocfs2/cluster/netdebug.c
@@ -133,36 +133,37 @@ static int nst_seq_show(struct seq_file *seq, void *v)
133 133
134 spin_lock(&o2net_debug_lock); 134 spin_lock(&o2net_debug_lock);
135 nst = next_nst(dummy_nst); 135 nst = next_nst(dummy_nst);
136 if (!nst)
137 goto out;
136 138
137 now = ktime_get(); 139 now = ktime_get();
138 sock = ktime_to_us(ktime_sub(now, nst->st_sock_time)); 140 sock = ktime_to_us(ktime_sub(now, nst->st_sock_time));
139 send = ktime_to_us(ktime_sub(now, nst->st_send_time)); 141 send = ktime_to_us(ktime_sub(now, nst->st_send_time));
140 status = ktime_to_us(ktime_sub(now, nst->st_status_time)); 142 status = ktime_to_us(ktime_sub(now, nst->st_status_time));
141 143
142 if (nst != NULL) { 144 /* get_task_comm isn't exported. oh well. */
143 /* get_task_comm isn't exported. oh well. */ 145 seq_printf(seq, "%p:\n"
144 seq_printf(seq, "%p:\n" 146 " pid: %lu\n"
145 " pid: %lu\n" 147 " tgid: %lu\n"
146 " tgid: %lu\n" 148 " process name: %s\n"
147 " process name: %s\n" 149 " node: %u\n"
148 " node: %u\n" 150 " sc: %p\n"
149 " sc: %p\n" 151 " message id: %d\n"
150 " message id: %d\n" 152 " message type: %u\n"
151 " message type: %u\n" 153 " message key: 0x%08x\n"
152 " message key: 0x%08x\n" 154 " sock acquiry: %lld usecs ago\n"
153 " sock acquiry: %lld usecs ago\n" 155 " send start: %lld usecs ago\n"
154 " send start: %lld usecs ago\n" 156 " wait start: %lld usecs ago\n",
155 " wait start: %lld usecs ago\n", 157 nst, (unsigned long)task_pid_nr(nst->st_task),
156 nst, (unsigned long)task_pid_nr(nst->st_task), 158 (unsigned long)nst->st_task->tgid,
157 (unsigned long)nst->st_task->tgid, 159 nst->st_task->comm, nst->st_node,
158 nst->st_task->comm, nst->st_node, 160 nst->st_sc, nst->st_id, nst->st_msg_type,
159 nst->st_sc, nst->st_id, nst->st_msg_type, 161 nst->st_msg_key,
160 nst->st_msg_key, 162 (long long)sock,
161 (long long)sock, 163 (long long)send,
162 (long long)send, 164 (long long)status);
163 (long long)status);
164 }
165 165
166out:
166 spin_unlock(&o2net_debug_lock); 167 spin_unlock(&o2net_debug_lock);
167 168
168 return 0; 169 return 0;