[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5052453b-edd8-44e2-8df7-00ea439805ad@openvpn.net>
Date: Tue, 3 Dec 2024 15:58:17 +0100
From: Antonio Quartulli <antonio@...nvpn.net>
To: Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
 sd@...asysnail.net, ryazanov.s.a@...il.com
Cc: Simon Horman <horms@...nel.org>, linux-kernel@...r.kernel.org,
 linux-kselftest@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Donald Hunter <donald.hunter@...il.com>,
 Shuah Khan <shuah@...nel.org>, Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH net-next v12 13/22] ovpn: implement peer lookup logic
On 02/12/2024 16:07, Antonio Quartulli wrote:
[...]
> +#define ovpn_get_hash_slot(_key, _key_len, _tbl) ({	\
> +	typeof(_tbl) *__tbl = &(_tbl);			\
> +	jhash(_key, _key_len, 0) % HASH_SIZE(*__tbl);	\
> +})
> +
> +#define ovpn_get_hash_head(_tbl, _key, _key_len) ({		\
> +	typeof(_tbl) *__tbl = &(_tbl);				\
> +	&(*__tbl)[ovpn_get_hash_slot(_key, _key_len, *__tbl)];	\
> +})
clang a reporting various warnings like this:
../drivers/net/ovpn/peer.c:406:9: warning: variable '__tbl' is 
uninitialized when used within its own initialization [-Wuninitialized]
   406 |         head = ovpn_get_hash_head(ovpn->peers->by_id, &peer_id,
       |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   407 |                                   sizeof(peer_id));
       |                                   ~~~~~~~~~~~~~~~~
../drivers/net/ovpn/peer.c:179:48: note: expanded from macro 
'ovpn_get_hash_head'
   179 |         &(*__tbl)[ovpn_get_hash_slot(_key, _key_len, *__tbl)];  \
       |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
../drivers/net/ovpn/peer.c:173:26: note: expanded from macro 
'ovpn_get_hash_slot'
   173 |         typeof(_tbl) *__tbl = &(_tbl);                  \
       |                       ~~~~~     ^~~~
Anybody willing to help me understand this issue?
I have troubles figuring out how __tbl is being used uninitialized.
I wonder if the parameters naming is fooling clang (or me) somehow.
Regards,
-- 
Antonio Quartulli
OpenVPN Inc.
Powered by blists - more mailing lists
 
