Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vDPA: fix 'cast to restricted le16' warnings in vdpa.c

This commit fixes spars warnings: cast to restricted __le16
in function vdpa_dev_net_config_fill() and
vdpa_fill_stats_rec()

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Message-Id: <20220722115309.82746-7-lingshan.zhu@intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Zhu Lingshan and committed by
Michael S. Tsirkin
79e0034c a34bed37

+3 -3
+3 -3
drivers/vdpa/vdpa.c
··· 824 824 config.mac)) 825 825 return -EMSGSIZE; 826 826 827 - val_u16 = le16_to_cpu(config.status); 827 + val_u16 = __virtio16_to_cpu(true, config.status); 828 828 if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) 829 829 return -EMSGSIZE; 830 830 831 - val_u16 = le16_to_cpu(config.mtu); 831 + val_u16 = __virtio16_to_cpu(true, config.mtu); 832 832 if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) 833 833 return -EMSGSIZE; 834 834 ··· 905 905 } 906 906 vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); 907 907 908 - max_vqp = le16_to_cpu(config.max_virtqueue_pairs); 908 + max_vqp = __virtio16_to_cpu(true, config.max_virtqueue_pairs); 909 909 if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MAX_VQP, max_vqp)) 910 910 return -EMSGSIZE; 911 911