Skip to content

Commit 08404c7

Browse files
committed
Fixing
1 parent 7f4b85a commit 08404c7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

virtio-snd.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,18 @@ static void virtio_snd_read_jack_info_handler(
249249
struct virtq_desc *vq_desc,
250250
const virtio_snd_query_info_t *query)
251251
{
252+
uint32_t cnt = query->count;
252253
virtio_snd_jack_info_t *info =
253-
(virtio_snd_jack_info_t *) ((uintptr_t) vq_desc[2].addr);
254-
for (uint32_t i = 0; i < query->count; i++) {
254+
(virtio_snd_jack_info_t *) malloc(sizeof(virtio_snd_jack_info_t) * cnt);
255+
for (uint32_t i = 0; i < cnt; i++) {
255256
info[i].hdr.hda_fn_nid = 0;
256257
info[i].features = 0;
257258
info[i].hda_reg_defconf = 0;
258259
info[i].hda_reg_caps = 0;
259260
info[i].connected = 1;
260261
memset(&info[i].padding, 0, sizeof(info[i].padding));
261262
}
263+
vq_desc[2].addr = (uintptr_t) info;
262264
}
263265

264266
static void virtio_snd_read_pcm_info_handler(

0 commit comments

Comments
 (0)