Skip to content

Commit 21e6435

Browse files
philmdmstsirkin
authored andcommitted
hw/virtio/virtio-mem: Use qemu_ram_get_fd() helper
Avoid accessing RAMBlock internals, use the provided qemu_ram_get_fd() getter to get the file descriptor. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230524093744.88442-7-philmd@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
1 parent 6df9562 commit 21e6435

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hw/virtio/virtio-mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static bool virtio_mem_has_shared_zeropage(RAMBlock *rb)
135135
* anonymous RAM. In any other case, reading unplugged *can* populate a
136136
* fresh page, consuming actual memory.
137137
*/
138-
return !qemu_ram_is_shared(rb) && rb->fd < 0 &&
138+
return !qemu_ram_is_shared(rb) && qemu_ram_get_fd(rb) < 0 &&
139139
qemu_ram_pagesize(rb) == qemu_real_host_page_size();
140140
}
141141
#endif /* VIRTIO_MEM_HAS_LEGACY_GUESTS */

0 commit comments

Comments
 (0)