lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8138fb02-f7c5-4c83-a4cb-d86412d8c048@lunn.ch>
Date: Wed, 22 Oct 2025 04:20:52 +0200
From: Andrew Lunn <andrew@...n.ch>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	Paolo Abeni <pabeni@...hat.com>, Jason Wang <jasowang@...hat.com>,
	Eugenio Pérez <eperezma@...hat.com>,
	Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
	Jonathan Corbet <corbet@....net>, kvm@...r.kernel.org,
	virtualization@...ts.linux.dev, linux-doc@...r.kernel.org
Subject: Re: [PATCH v2 1/2] virtio: clean up features qword/dword terms

> @@ -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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ