Skip to contentSkip to conversation

vhost: drop hard-coded num_buffers size

PATCH Applied Michael S. Tsirkin 2 participants 7 messages Feb 24, 2015 – Feb 27, 2015

Subsystems (5)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 vhost: drop hard-coded num_buffers size

The 2 that we use for copy_to_iter comes from sizeof(u16), it used to be that way before the iov iter update. Fix it up, making it obvious the size of stack access is right.

---
 drivers/vhost/net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vhost/net.c +2 -1
index ca70434..2bbfc25 100644
@@ -621,7 +621,8 @@ static void handle_rx(struct vhost_net *net)
 
 		num_buffers = cpu_to_vhost16(vq, headcount);
 		if (likely(mergeable) &&
-		    copy_to_iter(&num_buffers, 2, &fixup) != 2) {
+		    copy_to_iter(&num_buffers, sizeof num_buffers,
+				 &fixup) != sizeof num_buffers) {
 			vq_err(vq, "Failed num_buffers write");
 			vhost_discard_vq_desc(vq, headcount);
 			break;
Signature · 1 line
MST
maintainer
#1 lore raw

From: "Michael S. Tsirkin" <[email protected]>
Date: Tue, 24 Feb 2015 17:31:10 +0100

Quoted 6 lines

The 2 that we use for copy_to_iter comes from sizeof(u16), it used to be that way before the iov iter update. Fix it up, making it obvious the size of stack access is right.

Michael, what tree do you want these two patches to go through?

author maintainer
#2 lore raw
Quoted 11 lines · David Miller

From: "Michael S. Tsirkin" <[email protected]>
Date: Tue, 24 Feb 2015 17:31:10 +0100

Quoted 6 lines

The 2 that we use for copy_to_iter comes from sizeof(u16), it used to be that way before the iov iter update. Fix it up, making it obvious the size of stack access is right.

Michael, what tree do you want these two patches to go through?

Sorry about being unclear.
They are net specific so I'd like them merged for 4.0 through net tree. If that's a problem, pls let me know.

Thanks,

Signature · 1 line
MST
author maintainer
#3 lore raw
In reply to David Miller
Quoted 11 lines · David Miller

From: "Michael S. Tsirkin" <[email protected]>
Date: Tue, 24 Feb 2015 17:31:10 +0100

Quoted 6 lines

The 2 that we use for copy_to_iter comes from sizeof(u16), it used to be that way before the iov iter update. Fix it up, making it obvious the size of stack access is right.

Michael, what tree do you want these two patches to go through?

Sorry about being unclear.
They are net specific so I'd like them merged for 4.0 through net tree. If that's a problem, pls let me know.

Thanks,

Signature · 1 line
MST