netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Sasha Levin <sasha.levin@oracle.com>,
	herbert@gondor.apana.org.au, tgraf@suug.ch
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rhashtable: initialize all rhashtable walker members
Date: Sun, 22 Feb 2015 22:10:09 +0100	[thread overview]
Message-ID: <54EA45B1.6080701@iogearbox.net> (raw)
In-Reply-To: <1424552111-12077-1-git-send-email-sasha.levin@oracle.com>

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@oracle.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

      parent reply	other threads:[~2015-02-22 21:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-21 20:55 [PATCH] rhashtable: initialize all rhashtable walker members Sasha Levin
2015-02-22 20:58 ` David Miller
2015-02-22 21:28   ` Sasha Levin
2015-02-22 21:29     ` David Miller
2015-02-22 21:10 ` Daniel Borkmann [this message]

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=54EA45B1.6080701@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    --cc=tgraf@suug.ch \
    /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;
as well as URLs for NNTP newsgroup(s).