Skip to content

Commit 0b98c73

Browse files
agicyclaude
andcommitted
fix(virtio): fix virtqueue_enable_notify clearing all used_ring flags
The expression `!(uint16_t)VRING_USED_F_NO_NOTIFY` evaluates to 0 (logical NOT of 1), causing `flags &= 0` to clear every flag on the used ring — not just the intended VRING_USED_F_NO_NOTIFY bit. Replace with `~(uint16_t)VRING_USED_F_NO_NOTIFY` (bitwise NOT, 0xFFFE) to only clear the target bit. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 626bbf9 commit 0b98c73

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/virtio/virtio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void virtqueue_enable_notify(VirtQueue *vq) {
441441
if (vq->event_idx_enabled) {
442442
VQ_AVAIL_EVENT(vq) = vq->avail_ring->idx;
443443
} else {
444-
vq->used_ring->flags &= !(uint16_t)VRING_USED_F_NO_NOTIFY;
444+
vq->used_ring->flags &= ~(uint16_t)VRING_USED_F_NO_NOTIFY;
445445
}
446446
write_barrier();
447447
}

0 commit comments

Comments
 (0)