Re: [PATCH v2 03/12] vdpa: drop the VIRTIO_DEVICE_F_MASK example value
From: Eugenio Perez Martin
Date: Wed Aug 26 2026 - 05:13:36 EST
On Tue, Aug 18, 2026 at 11:15 PM Alexander Graf <graf@xxxxxxxxxx> wrote:
>
> The comment above VIRTIO_DEVICE_F_MASK spells the mask out by hand as
> 0xfffffc000fffffff, which was correct while VIRTIO_TRANSPORT_F_END was
> 41. The bound is 42 now, so the macro expands to 0xfffff8000fffffff and
> whoever reads the comment to check a feature mask against it gets the
> wrong boundary between transport and per-device bits.
>
> Correcting the number would leave a comment that has to be updated by
> hand every time the bound moves, and we already missed it once. Drop the
> expansion instead. The macro derives its value from the bound and needs
> no change.
>
> Fixes: 838bebb4c926 ("virtio: Define feature bit for administration virtqueue")
> Suggested-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
Acked-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
I'm not sure if a Fixes is needed though, as it will cause backports
(which means work) that don't fix any code.
> Assisted-by: Kiro:claude-opus-5 checkpatch sparse
> Signed-off-by: Alexander Graf <graf@xxxxxxxxxx>
> ---
> drivers/vdpa/vdpa.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> index 47c6c3d23f5c..395ca549573a 100644
> --- a/drivers/vdpa/vdpa.c
> +++ b/drivers/vdpa/vdpa.c
> @@ -548,10 +548,9 @@ vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb)
>
> /*
> * Bitmask for all per-device features: feature bits VIRTIO_TRANSPORT_F_START
> - * through VIRTIO_TRANSPORT_F_END are unset, i.e. 0xfffffc000fffffff for
> - * all 64bit features. If the features are extended beyond 64 bits, or new
> - * "holes" are reserved for other type of features than per-device, this
> - * macro would have to be updated.
> + * through VIRTIO_TRANSPORT_F_END are unset. If the features are extended
> + * beyond 64 bits, or new "holes" are reserved for other type of features
> + * than per-device, this macro would have to be updated.
> */
> #define VIRTIO_DEVICE_F_MASK (~0ULL << (VIRTIO_TRANSPORT_F_END + 1) | \
> ((1ULL << VIRTIO_TRANSPORT_F_START) - 1))
>