Subject: Re: linux-next: build warning after merge of the vhost tree

From: Xuan Zhuo <[email-masked]>
Date: Mon, 7 Mar 2022 17:41:05 +0800

On Mon, 7 Mar 2022 04:17:39 -0500, "Michael S. Tsirkin" <[email-masked]> wrote:
> On Mon, Mar 07, 2022 at 02:46:40PM +0800, Xuan Zhuo wrote:
> > On Mon, 7 Mar 2022 15:40:11 +1100, Stephen Rothwell <[email-masked]> wrote:
> > > Hi all,
> > >
> > > After merging the vhost tree, today's linux-next build (arm
> > > multi_v7_defconfig) produced this warning:
> > >
> > > drivers/net/virtio_net.c: In function 'virtnet_rx_vq_reset':
> > > drivers/net/virtio_net.c:1823:63: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Wformat=]
> > >  1823 |                    "reset rx reset vq fail: rx queue index: %ld err: %d\n",
> > >       |                                                             ~~^
> > >       |                                                               |
> > >       |                                                               long int
> > >       |                                                             %d
> > >  1824 |                    rq - vi->rq, err);
> > >       |                    ~~~~~~~~~~~
> > >       |                       |
> > >       |                       int
> > > drivers/net/virtio_net.c: In function 'virtnet_tx_vq_reset':
> > > drivers/net/virtio_net.c:1873:63: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Wformat=]
> > >  1873 |                    "reset tx reset vq fail: tx queue index: %ld err: %d\n",
> > >       |                                                             ~~^
> > >       |                                                               |
> > >       |                                                               long int
> > >       |                                                             %d
> > >  1874 |                    sq - vi->sq, err);
> > >       |                    ~~~~~~~~~~~
> > >       |                       |
> > >       |                       int
> > >
> > > Introduced by commit
> > >
> > >   920ee0c540a2 ("virtio_net: support rx/tx queue reset")
> > >
> >
> >
> > Can you help me test this patch? I don't have an arm environment around me.
> >
> > Thanks
>
>
> You should at least use
> https://mirrors.edge.kernel.org/pub/tools/crosstool/
> to test-build + test on x86.

I reproduced the problem using this method, and verified that this patch fixes
it. I submitted a patch email.

Thanks.

>
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index 1fa2d632a994..4d629d1ea894 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -1820,7 +1820,7 @@ static int virtnet_rx_vq_reset(struct virtnet_info *vi,
> >
> >  err:
> >         netdev_err(vi->dev,
> > -                  "reset rx reset vq fail: rx queue index: %ld err: %d\n",
> > +                  "reset rx reset vq fail: rx queue index: %td err: %d\n",
> >                    rq - vi->rq, err);
> >         virtnet_napi_enable(rq->vq, &rq->napi);
> >         return err;
> > @@ -1870,7 +1870,7 @@ static int virtnet_tx_vq_reset(struct virtnet_info *vi,
> >
> >  err:
> >         netdev_err(vi->dev,
> > -                  "reset tx reset vq fail: tx queue index: %ld err: %d\n",
> > +                  "reset tx reset vq fail: tx queue index: %td err: %d\n",
> >                    sq - vi->sq, err);
> >         virtnet_napi_tx_enable(vi, sq->vq, &sq->napi);
> >         return err;
> >
> > > --
> > > Cheers,
> > > Stephen Rothwell
> > >
>