Hello,

On Thu, Jun 18, 2020 at 9:39 AM Gaurav Singh <[email protected]> wrote:
>
> Add a NULL check for worker before dereferencing.

Did you actually see a segfault due to this?
It seems it's called with NULL only if multiq is false
so there should not be a NULL dereference.

>
> Signed-off-by: Gaurav Singh <[email protected]>
> ---
>  tools/perf/bench/epoll-wait.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/perf/bench/epoll-wait.c b/tools/perf/bench/epoll-wait.c
> index 75dca9773186..42983eb7f82e 100644
> --- a/tools/perf/bench/epoll-wait.c
> +++ b/tools/perf/bench/epoll-wait.c
> @@ -239,6 +239,9 @@ static void *workerfn(void *arg)
>
>  static void nest_epollfd(struct worker *w)
>  {
> +       if (!w)
> +               return;
> +
>         unsigned int i;
>         struct epoll_event ev;
>         int efd = multiq ? w->epollfd : epollfd;

Maybe it's more intuitive to check w instead of multiq here.

Thanks
Namhyung


> --
> 2.17.1
>

Reply via email to