From: Eric Dumazet <eduma...@google.com>
Date: Wed,  7 Nov 2018 22:10:53 -0800

> @@ -204,22 +205,22 @@ static struct inet_frag_queue *inet_frag_create(struct 
> netns_frags *nf,
>  /* TODO : call from rcu_read_lock() and no longer use 
> refcount_inc_not_zero() */
>  struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, void *key)
>  {
> -     struct inet_frag_queue *fq;
> +     struct inet_frag_queue *fq, *prev;
>  
>       if (!nf->high_thresh || frag_mem_limit(nf) > nf->high_thresh)
>               return NULL;
>  
>       rcu_read_lock();
>  
> -     fq = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params);
> -     if (fq) {
> +     prev = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params);
> +     if (!prev)
> +             fq = inet_frag_create(nf, key, &prev);
> +     if (prev && !IS_ERR(prev)) {
> +             fq = prev;
>               if (!refcount_inc_not_zero(&fq->refcnt))
>                       fq = NULL;
> -             rcu_read_unlock();
> -             return fq;
>       }
>       rcu_read_unlock();
> -
> -     return inet_frag_create(nf, key);
> +     return fq;

GCC is unwilling to see that all paths leading to that final return
statement do in fact set 'fq' one way or another:

net/ipv4/inet_fragment.c: In function ‘inet_frag_find’:
net/ipv4/inet_fragment.c:224:9: warning: ‘fq’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]

This is with:

gcc (GCC) 8.2.1 20181011 (Red Hat 8.2.1-4)

Please adjust your patch so that the warning is eliminated.

Thanks.

Reply via email to