[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH0PR12MB54815FFBEDBFEAC0CDC378DEDC829@PH0PR12MB5481.namprd12.prod.outlook.com>
Date: Fri, 8 Jul 2022 16:08:22 +0000
From: Parav Pandit <parav@...dia.com>
To: "Zhu, Lingshan" <lingshan.zhu@...el.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"mst@...hat.com" <mst@...hat.com>
CC: "virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"xieyongji@...edance.com" <xieyongji@...edance.com>,
"gautam.dawar@....com" <gautam.dawar@....com>
Subject: RE: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in
vdpa.c
> From: Zhu, Lingshan <lingshan.zhu@...el.com>
> Sent: Friday, July 8, 2022 2:25 AM
>
>
> On 7/2/2022 6:18 AM, Parav Pandit wrote:
> >> From: Zhu Lingshan <lingshan.zhu@...el.com>
> >> Sent: Friday, July 1, 2022 9:28 AM
> >>
> >> This commit fixes spars warnings: cast to restricted __le16 in
> >> function
> >> vdpa_dev_net_config_fill() and
> >> vdpa_fill_stats_rec()
> >>
> > Missing fixes tag.
> I am not sure whether this deserve a fix tag, I will look into it.
> >
> > But I fail to understand the warning.
> > config.status is le16, and API used is to convert le16 to cpu.
> > What is the warning about, can you please explain?
I see it. Its not le16, its __virtio16.
Please add fixes tag.
With that Reviewed-by: Parav Pandit <parav@...dia.com>
> The warnings are:
> drivers/vdpa/vdpa.c:828:19: warning: cast to restricted __le16
> drivers/vdpa/vdpa.c:828:19: warning: cast from restricted __virtio16
> >
> >> Signed-off-by: Zhu Lingshan <lingshan.zhu@...el.com>
> >> ---
> >> drivers/vdpa/vdpa.c | 6 +++---
> >> 1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index
> >> 846dd37f3549..ed49fe46a79e 100644
> >> --- a/drivers/vdpa/vdpa.c
> >> +++ b/drivers/vdpa/vdpa.c
> >> @@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct
> >> vdpa_device *vdev, struct sk_buff *ms
> >> config.mac))
> >> return -EMSGSIZE;
> >>
> >> - val_u16 = le16_to_cpu(config.status);
> >> + val_u16 = __virtio16_to_cpu(true, config.status);
> >> if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16))
> >> return -EMSGSIZE;
> >>
> >> - val_u16 = le16_to_cpu(config.mtu);
> >> + val_u16 = __virtio16_to_cpu(true, config.mtu);
> >> if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16))
> >> return -EMSGSIZE;
> >>
> >> @@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device
> >> *vdev, struct sk_buff *msg,
> >> }
> >> vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config));
> >>
> >> - max_vqp = le16_to_cpu(config.max_virtqueue_pairs);
> >> + max_vqp = __virtio16_to_cpu(true, config.max_virtqueue_pairs);
> >> if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MAX_VQP,
> >> max_vqp))
> >> return -EMSGSIZE;
> >>
> >> --
> >> 2.31.1
Powered by blists - more mailing lists