More fixes following Gonglei comments: - add a missing \n in a debug message. - add an explicit initialisation of sock_fd. - fix a check on vector index. Signed-off-by: David Marchand <david.marchand@xxxxxxxxx> --- contrib/ivshmem-client/ivshmem-client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/ivshmem-client/ivshmem-client.c b/contrib/ivshmem-client/ivshmem-client.c index e9a19ff..ad210c8 100644 --- a/contrib/ivshmem-client/ivshmem-client.c +++ b/contrib/ivshmem-client/ivshmem-client.c @@ -105,7 +105,7 @@ handle_server_msg(IvshmemClient *client) if (fd == -1) { if (peer == NULL || peer == &client->local) { - debug_log(client, "receive delete for invalid peer %ld", peer_id); + debug_log(client, "receive delete for invalid peer %ld\n", peer_id); return -1; } @@ -155,6 +155,7 @@ ivshmem_client_init(IvshmemClient *client, const char *unix_sock_path, client->notif_cb = notif_cb; client->notif_arg = notif_arg; client->verbose = verbose; + client->sock_fd = -1; return 0; } @@ -309,7 +310,7 @@ ivshmem_client_notify(const IvshmemClient *client, uint64_t kick; int fd; - if (vector > peer->vectors_count) { + if (vector >= peer->vectors_count) { debug_log(client, "invalid vector %u on peer %ld\n", vector, peer->id); return -1; } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html