If subblock size is large (e.g. 1G) 32 bit math involving it can overflow. Rather than try to catch all instances of that, let's tweak block size to 64 bit. It ripples through UAPI which is an ABI change, but it's not too late to make it, and it will allow supporting >4Gbyte blocks while might become necessary down the road.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -185,10 +185,10 @@ struct virtio_mem_resp { · 184 unmodified lines | ||
| 185 | 185 | |
| 186 | 186 | struct virtio_mem_config { |
| 187 | 187 | /* Block size and alignment. Cannot change. */ |
| 188 | − __u32 block_size; | |
| 188 | + __u64 block_size; | |
| 189 | 189 | /* Valid with VIRTIO_MEM_F_ACPI_PXM. Cannot change. */ |
| 190 | 190 | __u16 node_id; |
| 191 | − __u16 padding; | |
| 191 | + __u8 padding[6]; | |
| 192 | 192 | /* Start address of the memory region. Cannot change. */ |
| 193 | 193 | __u64 addr; |
| 194 | 194 | /* Region size (maximum). Cannot change. */ |