aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/lguest/lguest.c
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/lguest/lguest.c')
-rw-r--r--Documentation/lguest/lguest.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 9ebcd6ef361b..45d7d6dcae7a 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -1105,6 +1105,9 @@ static void set_config(struct device *dev, unsigned len, const void *conf)
1105 /* Copy in the config information, and store the length. */ 1105 /* Copy in the config information, and store the length. */
1106 memcpy(device_config(dev), conf, len); 1106 memcpy(device_config(dev), conf, len);
1107 dev->desc->config_len = len; 1107 dev->desc->config_len = len;
1108
1109 /* Size must fit in config_len field (8 bits)! */
1110 assert(dev->desc->config_len == len);
1108} 1111}
1109 1112
1110/* This routine does all the creation and setup of a new device, including 1113/* This routine does all the creation and setup of a new device, including
@@ -1515,7 +1518,8 @@ static void setup_block_file(const char *filename)
1515 add_feature(dev, VIRTIO_BLK_F_SEG_MAX); 1518 add_feature(dev, VIRTIO_BLK_F_SEG_MAX);
1516 conf.seg_max = cpu_to_le32(VIRTQUEUE_NUM - 2); 1519 conf.seg_max = cpu_to_le32(VIRTQUEUE_NUM - 2);
1517 1520
1518 set_config(dev, sizeof(conf), &conf); 1521 /* Don't try to put whole struct: we have 8 bit limit. */
1522 set_config(dev, offsetof(struct virtio_blk_config, geometry), &conf);
1519 1523
1520 verbose("device %u: virtblock %llu sectors\n", 1524 verbose("device %u: virtblock %llu sectors\n",
1521 ++devices.device_num, le64_to_cpu(conf.capacity)); 1525 ++devices.device_num, le64_to_cpu(conf.capacity));