-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rectify length of Virtio descriptor address #72
Conversation
virtio-blk.c
Outdated
vq_desc[i].addr = desc->addr; | ||
vq_desc[i].len = desc->len; | ||
vq_desc[i].flags = desc->flags; | ||
desc_idx = desc->next; /* vq_desc[desc_cnt].next */ |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
virtio-rng.c
Outdated
.flags = desc[3], | ||
}; | ||
struct virtq_desc vq_desc = | ||
*(struct virtq_desc *) &vrng->ram[queue->QueueDesc + buffer_idx * 4]; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
virtio-rng.c
Outdated
|
||
/* Write entropy buffer */ | ||
void *entropy_buf = | ||
(void *) ((uintptr_t) vrng->ram + (uintptr_t) vq_desc.addr); | ||
ssize_t total = read(rng_fd, entropy_buf, vq_desc.len); | ||
|
||
/* Clear write flag */ | ||
desc[3] = 0; | ||
vq_desc.flags = 0; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
virtio.h
Outdated
@@ -58,7 +58,7 @@ enum { | |||
}; | |||
|
|||
struct virtq_desc { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid unnecessary capitalization. That is, use "Rectify length of Virtio descriptor address" instead of "Rectify Length of Virtio Descriptor Address."
According to Virtio Specification Version 1.3, Section 2.7.5 *The Virtqueue Descriptor Table*, the type of 'addr' should be 'uint64_t' instead of 'uint32_t'. This commit addresses the error in the previous implementation. Co-authored-by: Shengwen Cheng <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks legitimate.
Thank @otteryc for contributing! |
According to Virtio Specification Version 1.3, Section 2.7.5 The Virtqueue Descriptor Table, the type of
addr
should beuint64_t
instead ofuint32_t
.This commit addresses the error in the previous implementation.