From: Tejun Heo <tj@kernel.org>
To: Richard Weinberger <richard@nod.at>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] print_worker_info: Handle pointer with more care
Date: Fri, 16 Aug 2013 12:12:29 -0400 [thread overview]
Message-ID: <20130816161229.GI2505@htj.dyndns.org> (raw)
In-Reply-To: <1376668606-32354-1-git-send-email-richard@nod.at>
On Fri, Aug 16, 2013 at 05:56:46PM +0200, Richard Weinberger wrote:
> The function has a nice comment:
> /*
> * This function is called without any synchronization and @task
> * could be in any state. Be careful with dereferences.
> */
>
> But a few lines later it blindly dereferences a few pointers.
> E.g. It can happen that the worker function is already done,
> then worker->current_pwq is NULL.
...
> probe_kernel_read(&fn, &worker->current_func, sizeof(fn));
> probe_kernel_read(&pwq, &worker->current_pwq, sizeof(pwq));
> + if (!pwq)
> + goto print;
> +
> probe_kernel_read(&wq, &pwq->wq, sizeof(wq));
> + if (!wq)
> + goto print;
> +
But none of the above are dereferences. &ptr->field is offset
calculation, not a dereference.
Thanks.
--
tejun
next prev parent reply other threads:[~2013-08-16 16:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-16 15:56 [PATCH] print_worker_info: Handle pointer with more care Richard Weinberger
2013-08-16 16:12 ` Tejun Heo [this message]
2013-08-16 16:15 ` Richard Weinberger
2013-08-16 16:28 ` Tejun Heo
2013-08-16 16:38 ` Richard Weinberger
2013-08-16 16:45 ` Tejun Heo
2013-08-16 16:53 ` Richard Weinberger
2013-08-16 17:20 ` Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130816161229.GI2505@htj.dyndns.org \
--to=tj@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox