Re: [PATCH] vhost: Fix typos in comments and clarity on alignof usage

From: Simon Horman
Date: Tue Jun 17 2025 - 14:39:59 EST


On Sun, Jun 15, 2025 at 10:39:11AM -0700, Alok Tiwari wrote:
> This patch fixes multiple typos and improves comment clarity across
> vhost.c.
> - Correct spelling errors: "thead" -> "thread", "RUNNUNG" -> "RUNNING"
> and "available".
> - Improve comment by replacing informal comment ("Supersize me!")
> with a clear description.
> - Use __alignof__ correctly on dereferenced pointer types for better
> readability and alignment with kernel documentation.

Could you expand on the last point?
I see that the patch uses __alignof__ with rather than without parentheses.
But I don't follow how that corresponds with the comment above.

>
> These changes enhance code readability and maintainability.
>
> Signed-off-by: Alok Tiwari <alok.a.tiwari@xxxxxxxxxx>

...

> @@ -1898,8 +1898,8 @@ static long vhost_vring_set_addr(struct vhost_dev *d,
> return -EFAULT;
>
> /* Make sure it's safe to cast pointers to vring types. */
> - BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
> - BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE);
> + BUILD_BUG_ON(__alignof__(*vq->avail) > VRING_AVAIL_ALIGN_SIZE);
> + BUILD_BUG_ON(__alignof__(*vq->used) > VRING_USED_ALIGN_SIZE);
> if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) ||
> (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) ||
> (a.log_guest_addr & (VRING_USED_ALIGN_SIZE - 1)))

...