[dpdk-dev] [PATCH] hash: fix gcc 10 maybe-uninitialized warning

David Marchand david.marchand at redhat.com
Mon May 18 13:48:47 CEST 2020


On Fri, May 15, 2020 at 4:28 PM Kevin Traynor <ktraynor at redhat.com> wrote:
>
> gcc 10.1.1 reports a warning for the ext_bkt_id variable:
>
> ../lib/librte_hash/rte_cuckoo_hash.c:
> In function ‘__rte_hash_add_key_with_hash’:
> ../lib/librte_hash/rte_cuckoo_hash.c:1104:29:
> warning: ‘ext_bkt_id’ may be used uninitialized in this function
> [-Wmaybe-uninitialized]
>  1104 |  (h->buckets_ext[ext_bkt_id - 1]).sig_current[0] = short_sig;
>       |                  ~~~~~~~~~~~^~~
>
> The return value of rte_ring_sc_dequeue_elem() is already checked,
> but also initialize ext_bkt_id to zero (invalid value) and check
> that it also overwritten.
>
> Fixes: fbfe568103b0 ("hash: use 32-bit elements rings to save memory")
> Cc: stable at dpdk.org
>
> Signed-off-by: Kevin Traynor <ktraynor at redhat.com>

Acked-by: Yipeng Wang <yipeng1.wang at intel.com>


Applied, thanks.

-- 
David Marchand



More information about the dev mailing list