[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241021193623.2830318-1-gnaaman@drivenets.com>
Date: Mon, 21 Oct 2024 19:36:22 +0000
From: Gilad Naaman <gnaaman@...venets.com>
To: kuniyu@...zon.com
Cc: davem@...emloft.net,
edumazet@...gle.com,
gnaaman@...venets.com,
kuba@...nel.org,
netdev@...r.kernel.org,
pabeni@...hat.com
Subject: Re: [PATCH net-next v6 1/6] neighbour: Add hlist_node to struct neighbour
> > @@ -530,27 +532,47 @@ static void neigh_get_hash_rnd(u32 *x)
> >
> > static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
> > {
> > + size_t hash_heads_size = (1 << shift) * sizeof(struct hlist_head);
> > size_t size = (1 << shift) * sizeof(struct neighbour *);
> > - struct neigh_hash_table *ret;
> > struct neighbour __rcu **buckets;
> > + struct hlist_head *hash_heads;
> > + struct neigh_hash_table *ret;
> > int i;
> >
> > + hash_heads = NULL;
>
> nit: This init is not needed.
This is needed in order to prevent unitialized memory access if we failed to
allocate `buckets`.
If possible I'd prefer to leave this as-is, given that this is rewritten later,
in commit 5.
> > @@ -564,6 +586,8 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
> > rcu);
> > size_t size = (1 << nht->hash_shift) * sizeof(struct neighbour *);
> > struct neighbour __rcu **buckets = nht->hash_buckets;
> > + size_t hash_heads_size = (1 << nht->hash_shift) * sizeof(struct hlist_head);
> > + struct hlist_head *hash_heads = nht->hash_heads;
>
> nit: reverse xmas tree order.
Apologies, I thought I squashed all of these, I'll be more thorough next time.
Powered by blists - more mailing lists