Re: [PATCH RFC net-next v3 6/8] virtio/vsock: support dgrams

From: Dan Carpenter
Date: Wed May 31 2023 - 14:13:17 EST


On Wed, May 31, 2023 at 06:09:11PM +0200, Simon Horman wrote:
> > @@ -102,6 +144,7 @@ virtio_transport_alloc_skb(struct virtio_vsock_pkt_info *info,
>
> Smatch that err may not be initialised in the out label below.
>
> Just above this context the following appears:
>
> if (info->vsk && !skb_set_owner_sk_safe(skb, sk_vsock(info->vsk))) {
> WARN_ONCE(1, "failed to allocate skb on vsock socket with sk_refcnt == 0\n");
> goto out;
> }
>
> So I wonder if in that case err may not be initialised.
>

Yep, exactly right. I commented out the goto and it silenced the
warning. I also initialized err to zero at the start hoping that it
would trigger a different warning but it didn't. :(

regards,
dan carpenter


> > return skb;
> >
> > out:
> > + *errp = err;
> > kfree_skb(skb);
> > return NULL;
> > }