[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54EA45B1.6080701@iogearbox.net>
Date: Sun, 22 Feb 2015 22:10:09 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Sasha Levin <sasha.levin@...cle.com>, herbert@...dor.apana.org.au,
tgraf@...g.ch
CC: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rhashtable: initialize all rhashtable walker members
On 02/21/2015 09:55 PM, Sasha Levin wrote:
> Commit "rhashtable: Introduce rhashtable_walk_*" forgot to initialize the
> members of struct rhashtable_walker after allocating it, which caused
> an undefined value for 'resize' which is used later on.
>
> Signed-off-by: Sasha Levin <sasha.levin@...cle.com>
> ---
> lib/rhashtable.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
> index 9cc4c4a..030484c 100644
> --- a/lib/rhashtable.c
> +++ b/lib/rhashtable.c
> @@ -894,6 +894,9 @@ int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter)
> if (!iter->walker)
> return -ENOMEM;
>
> + INIT_LIST_HEAD(&iter->walker->list);
> + iter->walker->resize = false;
> +
The change seems fine to me, although the INIT_LIST_HEAD() unnecessary
due to the below list_add()?
Anyway, setting resize to false is definitely correct. In practice this
shouldn't cause much issue though as rhashtable_walk_start() would only
reset iterator meta data and set resize to false, but lets fix it.
> mutex_lock(&ht->mutex);
> list_add(&iter->walker->list, &ht->walkers);
> mutex_unlock(&ht->mutex);
Thanks,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists