Re: [PATCH] vdagent: VDP_LAST_PORT is redundant with VDP_END_PORT. Remove it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK, I'd add something like this to the commit log though:
« VDP_LAST_PORT is equal to VDP_SERVER_PORT while VDP_END_PORT (defined in
spice-protocol) is VDP_SERVER_PORT + 1 so the code needs to be adjusted
to account for this difference. »


On Thu, Nov 05, 2015 at 07:20:58PM +0100, Francois Gouget wrote:
> Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
> ---
>  src/vdagent-virtio-port.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/vdagent-virtio-port.c b/src/vdagent-virtio-port.c
> index b04d55b..722f3ba 100644
> --- a/src/vdagent-virtio-port.c
> +++ b/src/vdagent-virtio-port.c
> @@ -31,7 +31,6 @@
>  
>  #include "vdagent-virtio-port.h"
>  
> -#define VDP_LAST_PORT VDP_SERVER_PORT
>  
>  struct vdagent_virtio_port_buf {
>      uint8_t *buf;
> @@ -63,7 +62,7 @@ struct vdagent_virtio_port {
>      uint8_t chunk_data[VD_AGENT_MAX_DATA_SIZE];
>  
>      /* Per chunk port data */
> -    struct vdagent_virtio_port_chunk_port_data port_data[VDP_LAST_PORT + 1];
> +    struct vdagent_virtio_port_chunk_port_data port_data[VDP_END_PORT];
>  
>      /* Writes are stored in a linked list of buffers, with both the header
>         + data for a single message in 1 buffer. */
> @@ -142,7 +141,7 @@ void vdagent_virtio_port_destroy(struct vdagent_virtio_port **vportp)
>          wbuf = next_wbuf;
>      }
>  
> -    for (i = 0; i <= VDP_LAST_PORT; i++) {
> +    for (i = 0; i < VDP_END_PORT; i++) {
>          free(vport->port_data[i].message_data);
>      }
>  
> @@ -287,7 +286,7 @@ void vdagent_virtio_port_flush(struct vdagent_virtio_port **vportp)
>  
>  void vdagent_virtio_port_reset(struct vdagent_virtio_port *vport, int port)
>  {
> -    if (port > VDP_LAST_PORT) {
> +    if (port >= VDP_END_PORT) {
>          syslog(LOG_ERR, "vdagent_virtio_port_reset port out of range");
>          return;
>      }
> @@ -427,7 +426,7 @@ static void vdagent_virtio_port_do_read(struct vdagent_virtio_port **vportp)
>                  vdagent_virtio_port_destroy(vportp);
>                  return;
>              }
> -            if (vport->chunk_header.port > VDP_LAST_PORT) {
> +            if (vport->chunk_header.port >= VDP_END_PORT) {
>                  syslog(LOG_ERR, "chunk port %u out of range",
>                         vport->chunk_header.port);
>                  vdagent_virtio_port_destroy(vportp);
> -- 
> 2.6.1
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]