Skip to content

Commit

Permalink
block/export: fix blk_size double byteswap
Browse files Browse the repository at this point in the history
The config->blk_size field is little-endian. Use the native-endian
blk_size variable to avoid double byteswapping.

Fixes: 11f60f7 ("block/export: make vhost-user-blk config space little-endian")
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210223144653.811468-8-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
stefanhaRH authored and kevmw committed Mar 8, 2021
1 parent e1fa7f5 commit a4f1542
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/export/vhost-user-blk-server.c
Expand Up @@ -356,7 +356,7 @@ vu_blk_initialize_config(BlockDriverState *bs,
config->num_queues = cpu_to_le16(num_queues);
config->max_discard_sectors = cpu_to_le32(32768);
config->max_discard_seg = cpu_to_le32(1);
config->discard_sector_alignment = cpu_to_le32(config->blk_size >> 9);
config->discard_sector_alignment = cpu_to_le32(blk_size >> 9);
config->max_write_zeroes_sectors = cpu_to_le32(32768);
config->max_write_zeroes_seg = cpu_to_le32(1);
}
Expand Down

0 comments on commit a4f1542

Please sign in to comment.