[Spice-devel] [PATCH spice-server 7/9] reds: Fix wrong assert

Frediano Ziglio fziglio at redhat.com
Tue Dec 5 08:41:10 UTC 2017


RedVDIReadBuf::data is a static allocated buffer so checking for
NULL on it is useless. It would be NULL only if RedVDIReadBuf
pointer would be the opposite, in value, of the offset of
data field into it.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
Maybe this check should just be removed?
---
 server/reds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index ab41244c..f5b9ffd2 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1239,7 +1239,7 @@ void reds_on_main_channel_migrate(RedsState *reds, MainChannelClient *mcc)
     if (agent_dev->priv->read_state != VDI_PORT_READ_STATE_READ_DATA) {
         return;
     }
-    spice_assert(agent_dev->priv->current_read_buf->data &&
+    spice_assert(agent_dev->priv->current_read_buf &&
                  agent_dev->priv->receive_pos > agent_dev->priv->current_read_buf->data);
     read_data_len = agent_dev->priv->receive_pos - agent_dev->priv->current_read_buf->data;
 
-- 
2.14.3



More information about the Spice-devel mailing list