> @@ -1752,7 +1752,7 @@ static long vhost_net_ioctl(struct file *f, unsigned
> int ioctl,
>
> /* Copy the net features, up to the user-provided buffer size */
> argp += sizeof(u64);
> - copied = min(count, VIRTIO_FEATURES_DWORDS);
> + copied = min(count, (u64)VIRTIO_FEATURES_ARRAY_SIZE);
Why is the cast needed? Why was 2 O.K, but (128 >> 6) needs a cast?
> -#define VIRTIO_FEATURES_DWORDS 2
> -#define VIRTIO_FEATURES_MAX (VIRTIO_FEATURES_DWORDS * 64)
> -#define VIRTIO_FEATURES_WORDS (VIRTIO_FEATURES_DWORDS * 2)
> +#define VIRTIO_FEATURES_BITS (128)
> #define VIRTIO_BIT(b) BIT_ULL((b) & 0x3f)
> -#define VIRTIO_DWORD(b) ((b) >> 6)
> +#define VIRTIO_U64(b) ((b) >> 6)
> +
> +#define VIRTIO_FEATURES_ARRAY_SIZE VIRTIO_U64(VIRTIO_FEATURES_BITS)
Andrew