Skip to content

Commit ca72cc3

Browse files
Alexander Duyckmstsirkin
authored andcommitted
virtio-balloon: Document byte ordering of poison_val
The poison_val field in the virtio_balloon_config is treated as a little-endian field by the host. Since we are currently only having to deal with a single byte poison value this isn't a problem, however if the value should ever expand it would cause byte ordering issues. Document that in the code so that we know that if the value should ever expand we need to byte swap the value on big-endian architectures. Signed-off-by: Alexander Duyck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: David Hildenbrand <[email protected]>
1 parent 295c1b9 commit ca72cc3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/virtio/virtio_balloon.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,11 @@ static int virtballoon_probe(struct virtio_device *vdev)
974974
/*
975975
* Let the hypervisor know that we are expecting a
976976
* specific value to be written back in balloon pages.
977+
*
978+
* If the PAGE_POISON value was larger than a byte we would
979+
* need to byte swap poison_val here to guarantee it is
980+
* little-endian. However for now it is a single byte so we
981+
* can pass it as-is.
977982
*/
978983
if (!want_init_on_free())
979984
memset(&poison_val, PAGE_POISON, sizeof(poison_val));

0 commit comments

Comments
 (0)