lkml.org 
[lkml]   [2013]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] print_worker_info: Handle pointer with more care
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


\
 
 \ /
  Last update: 2013-08-16 18:21    [W:0.056 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site