netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch -next] VSOCK: signedness bug in virtio_transport_dgram_enqueue()
@ 2015-12-09 10:27 Dan Carpenter
  2015-12-10  2:21 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-12-09 10:27 UTC (permalink / raw)
  To: David S. Miller, Asias He
  Cc: Ray Jui, Scott Branden, Jon Mason, Stefan Hajnoczi, netdev,
	bcm-kernel-feedback-list, kernel-janitors

"written" has to be signed for the error handling to work.
trans->ops->send_pkt() returns an int so that's fine.

Fixes: 80a19e338d45 ('VSOCK: Introduce virtio-vsock-common.ko')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index 28f790d..d9a2325 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -815,7 +815,8 @@ virtio_transport_dgram_enqueue(struct vsock_sock *vsk,
 		.type = VIRTIO_VSOCK_TYPE_DGRAM,
 		.msg = msg,
 	};
-	size_t total_written = 0, pkt_off = 0, written;
+	size_t total_written = 0, pkt_off = 0;
+	int written;
 	u16 dgram_id;
 
 	/* The max size of a single dgram we support is 64KB */
@@ -845,7 +846,7 @@ virtio_transport_dgram_enqueue(struct vsock_sock *vsk,
 		}
 		total_written += written;
 		pkt_off += written;
-		pr_debug("%s:id=%d, dgram_len=%zu, off=%zu, total_written=%zu, written=%zu\n",
+		pr_debug("%s:id=%d, dgram_len=%zu, off=%zu, total_written=%zu, written=%d\n",
 			  __func__, dgram_id, dgram_len, pkt_off, total_written, written);
 	}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch -next] VSOCK: signedness bug in virtio_transport_dgram_enqueue()
  2015-12-09 10:27 [patch -next] VSOCK: signedness bug in virtio_transport_dgram_enqueue() Dan Carpenter
@ 2015-12-10  2:21 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2015-12-10  2:21 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David S. Miller, Asias He, Ray Jui, Scott Branden, Jon Mason,
	netdev, bcm-kernel-feedback-list, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]

On Wed, Dec 09, 2015 at 01:27:13PM +0300, Dan Carpenter wrote:
> "written" has to be signed for the error handling to work.
> trans->ops->send_pkt() returns an int so that's fine.
> 
> Fixes: 80a19e338d45 ('VSOCK: Introduce virtio-vsock-common.ko')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index 28f790d..d9a2325 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
> @@ -815,7 +815,8 @@ virtio_transport_dgram_enqueue(struct vsock_sock *vsk,
>  		.type = VIRTIO_VSOCK_TYPE_DGRAM,
>  		.msg = msg,
>  	};
> -	size_t total_written = 0, pkt_off = 0, written;
> +	size_t total_written = 0, pkt_off = 0;
> +	int written;
>  	u16 dgram_id;
>  
>  	/* The max size of a single dgram we support is 64KB */
> @@ -845,7 +846,7 @@ virtio_transport_dgram_enqueue(struct vsock_sock *vsk,
>  		}
>  		total_written += written;
>  		pkt_off += written;
> -		pr_debug("%s:id=%d, dgram_len=%zu, off=%zu, total_written=%zu, written=%zu\n",
> +		pr_debug("%s:id=%d, dgram_len=%zu, off=%zu, total_written=%zu, written=%d\n",
>  			  __func__, dgram_id, dgram_len, pkt_off, total_written, written);
>  	}
>  

Thanks!

The dgram functionality has been dropped in the latest patch revision
but I'll keep your fix in mind if it's brought back.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-10  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 10:27 [patch -next] VSOCK: signedness bug in virtio_transport_dgram_enqueue() Dan Carpenter
2015-12-10  2:21 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).