File xen.tapdisk_vbd_open_level.patch of Package xen
From: Olaf Hering <olaf@aepfle.de>
Date: Mon, 15 Jun 2020 23:39:28 +0200
Subject: tapdisk_vbd_open_level
tapdisk-vbd.c: In function '__tapdisk_vbd_open_vdi':
tapdisk-vbd.c:374:4: error: array subscript -9 is outside array bounds of 'struct list_head[1]' [-Werror=array-bounds]
374 | td_close(image);
| ^~~~~~~~~~~~~~~
In file included from tapdisk.h:62,
from tapdisk-image.h:31,
from tapdisk-vbd.c:41:
tapdisk-vbd.c:401:13: note: while referencing 'images'
401 | LIST_HEAD(images);
| ^~~~~~
../include/list.h:32:26: note: in definition of macro 'LIST_HEAD'
32 | struct list_head name = LIST_HEAD_INIT(name)
| ^~~~
tapdisk-vbd.c:375:4: error: array subscript -9 is outside array bounds of 'struct list_head[1]' [-Werror=array-bounds]
375 | tapdisk_image_free(image);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from tapdisk.h:62,
from tapdisk-image.h:31,
from tapdisk-vbd.c:41:
tapdisk-vbd.c:401:13: note: while referencing 'images'
401 | LIST_HEAD(images);
| ^~~~~~
../include/list.h:32:26: note: in definition of macro 'LIST_HEAD'
32 | struct list_head name = LIST_HEAD_INIT(name)
| ^~~~
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/blktap2/drivers/tapdisk-vbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/tools/blktap2/drivers/tapdisk-vbd.c
+++ b/tools/blktap2/drivers/tapdisk-vbd.c
@@ -361,25 +361,25 @@ tapdisk_vbd_open_level(td_vbd_t *vbd, struct list_head *head,
type = id.drivertype;
flags |= (TD_OPEN_RDONLY | TD_OPEN_SHAREABLE);
}
out:
if (err) {
if (image) {
td_close(image);
tapdisk_image_free(image);
}
while (!list_empty(head)) {
- image = list_entry(&head->next, td_image_t, next);
+ image = list_entry(head->next, td_image_t, next);
td_close(image);
tapdisk_image_free(image);
}
}
return err;
}
static int
__tapdisk_vbd_open_vdi(td_vbd_t *vbd, td_flag_t extra_flags)
{
int err;