summaryrefslogtreecommitdiffstats
path: root/tapset
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2011-05-31 15:44:21 -0400
committerSteve Dickson <steved@redhat.com>2011-05-31 15:44:21 -0400
commit84a70c37f4bd31a22d7b3a6af1d89dc4771e59a6 (patch)
tree80f0936f75367782a512f99453e748f29da8e2b1 /tapset
parent4f72df7bb132da0b340795ef6f0118ceb54ba6a4 (diff)
downloadsystemtap-84a70c37f4bd31a22d7b3a6af1d89dc4771e59a6.tar.gz
systemtap-84a70c37f4bd31a22d7b3a6af1d89dc4771e59a6.tar.xz
systemtap-84a70c37f4bd31a22d7b3a6af1d89dc4771e59a6.zip
Fixed null pointers in xprt_dump()
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'tapset')
-rw-r--r--tapset/task.stp24
1 files changed, 17 insertions, 7 deletions
diff --git a/tapset/task.stp b/tapset/task.stp
index 1500a4d..f9390db 100644
--- a/tapset/task.stp
+++ b/tapset/task.stp
@@ -24,19 +24,29 @@ function task_dump:string(_task:long)
%}
function xprt_dump:string(_task:long)
%{
- struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
- struct rpc_rqst *req = (struct rpc_rqst *)(long) kread(&(task->tk_rqstp));
- struct rpc_xprt *xprt = (struct rpc_xprt *)(long) kread(&(req->rq_xprt));
+ struct rpc_task *task;
+ struct rpc_rqst *req;
+ struct rpc_xprt *xprt;
char buf[64];
int cc=0;
if (task <= 0) {
sprintf(buf+cc, "task NULL");
- } else {
- sprintf(buf+cc, ": xprt 0x%p ops 0x%p",
- xprt, xprt->ops);
- cc = strlen(buf);
+ goto leave;
+ }
+ req = (struct rpc_rqst *)(long) kread(&(task->tk_rqstp));
+ if (req <= 0) {
+ sprintf(buf+cc, "req is NULL");
+ goto leave;
+ }
+ xprt = (struct rpc_xprt *)(long) kread(&(req->rq_xprt));
+ if (xprt <= 0) {
+ sprintf(buf+cc, "xprt is NULL");
+ goto leave;
}
+ sprintf(buf+cc, ": xprt 0x%p ops 0x%p", xprt, xprt->ops);
+ cc = strlen(buf);
+leave:
snprintf(THIS->__retvalue, 64, "%s", buf);
CATCH_DEREF_FAULT();