Skip to content

Commit a0dbd67

Browse files
jmichalski-antkartben
authored andcommitted
fs: virtiofs: fix off-by-one in virtqueue initialization
REQUEST_QUEUE was passed as queue_num to virtio_init_virtqueues where REQUEST_QUEUE+1 was required Signed-off-by: Jakub Michalski <[email protected]>
1 parent d76e000 commit a0dbd67

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

subsys/fs/virtiofs/virtiofs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ LOG_MODULE_REGISTER(virtiofs, CONFIG_VIRTIOFS_LOG_LEVEL);
3131
#define REQUEST_QUEUE 2
3232
#endif
3333

34+
/*
35+
* Currently we are using only one request queue, so we don't have to initialize queues
36+
* after that one
37+
*/
38+
#define QUEUE_COUNT (REQUEST_QUEUE + 1)
39+
3440

3541
struct virtio_fs_config {
3642
char tag[36];
@@ -132,7 +138,7 @@ int virtiofs_init(const struct device *dev, struct fuse_init_out *response)
132138
return ret;
133139
}
134140

135-
ret = virtio_init_virtqueues(dev, REQUEST_QUEUE, virtiofs_queue_enum_cb, NULL);
141+
ret = virtio_init_virtqueues(dev, QUEUE_COUNT, virtiofs_queue_enum_cb, NULL);
136142
if (ret != 0) {
137143
LOG_ERR("failed to initialize fs virtqueues");
138144
return ret;

0 commit comments

Comments
 (0)